Simple - Changing your network settings without rebooting???
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You shouldn't need to reboot after using netconfig; what you probably have to do is bring the interface(s) down and up (that's what happens during reboot anyway) when you make changes. Probably either one of these (I don't do much changes to my network settings, and I'm working on a non-Linux box atm, so just guessing):
Code:
ifconfg eth0 down
ifdown eth0
and then configure the settings you like and do either one of these:
Code:
ifconfig eth0 up
ifup eth0
That should work.
EDIT: you could also use ifconfig to change ip address etc. like
Code:
ifconfig eth0 down
ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
If eth0 is the interface over which your putty traffic is travelling, taking down that connecting will prevent further communication with the machine.
I think you mean &&, not $$. $$ means "the PID of the current shell". left && right means "if left returned no error, execute right.
In this case it might be better to separate the commands with ; which means all commands will be executed regardless of the success of the previous command. I've thrown a sleep in there too. I don't know if it's necessary, but it might help make it a little more robust - some interfaces like to be left alone for a few seconds before you brind them back up.
Code:
ifconfig eth0 down ; sleep 2 ; ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
One more thing. Bringing down the putty session might stop the commands after "ifconfig eth0 down" from running. Consider running it all inside a screen session.
ip addr add 172.16.16.19/22 dev eth0 broadcast 172.16.19.255
That was pretty self explainable.
ip address add <ip>/<mask> dev <dev-name> broadcast <broadcast-ip(is required moreoften when you have not mentioned a mask)>
There are many other options availbale with ip add command, ip addr help would be more supportive for the rest.
debian:~# ip addr add 172.16.16.19/22 dev eth0 broadcast 172.16.19.255
-su: ip: command not found
is that distro specific or part of a particular tool that needs to be installed ?
That's the reason I asked, because it doesn't seem to work..
A bit of searching finally turned up the answer..
in ordert to use ip addr add you must have the iproute package installed.
Quote:
debian:~# apt-cache search iproute iproute - Professional tools to control the networking in Linux kernels
iproute-dev - Development package for iproute
iproute-doc - Professional tools to control the networking in Linux kernels
libabz0 - Miscellaneous useful routines
debian:~# apt-get install iproute
.
.
debian:~# ip addr help
Usage: ip addr {add|del} IFADDR dev STRING
ip addr {show|flush} [ dev STRING ] [ scope SCOPE-ID ]
[ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ]
that's whay I was so confused by your response... It didn't work for me, because it requires another package to be installed that isn't installed by default, and the package name required was never mentioned.. I get it now..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.