Simple - Changing your network settings without rebooting???
Hi,
I just started using Linux again. Its been a year and iv forgotten almost everything.. I remembered "netconfig" WOO but I have to reboot my box every time i make a change in it. How do i get it to change with out rebooting. P.S - I remembered "ifconfig" to WAHHOOO I’m a Linux Guru Thanks Nick (Linux Guru :D) |
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 Code:
ifconfig eth0 up EDIT: you could also use ifconfig to change ip address etc. like Code:
ifconfig eth0 down |
I shall give this a go!! Thanks for the speedy Reply!
Nick |
Just had a thought!!!
Im connecting using putty. If i take my etho down this will disconect me? I remember $$ command? can i do ifconfig eth0 down $$ ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up then re-putty back in?? Nick |
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.
|
if you edit the network config manually I would think you could also use
/etc/init.d/networking restart |
ip addr add 172.16.16.19/22 dev eth0 broadcast 172.16.19.255
|
Quote:
Is this response for this thread or was it supposed to be for something else ? A little explanation along with the response would be helpful.. |
Quote:
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. |
Code:
debian:~# ip addr add 172.16.16.19/22 dev eth0 broadcast 172.16.19.255 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:
|
All times are GMT -5. The time now is 04:07 AM. |