Re: static ip address is being reset constantly
2009/9/5 Jesús M. Navarro <jesus.navarro@undominio.net>:
> On Friday 04 September 2009 14:21:25 John O Laoi wrote:
>>> Verify that no dhcp process is running in the background. If there is
>>> none remove the network manager.
>> Indeed there was DHCP processes running:
>> # ps aux | grep dhc
>> root 3650 0.0 0.0 0 0 ? Z 08:31 0:00
>> [dhclient] <defunct>
>> root 4044 0.0 0.0 2204 608 ? S<s 08:32 0:00
>> dhclient3 -pf /var/run/dhclient.eth0.pid -lf
>> /var/lib/dhcp3/dhclient.eth0.leases eth0
>> root 11612 0.0 0.0 2204 572 ? Ss 11:39 0:00 dhclient
>> eth0 root 12702 0.0 0.0 3192 752 pts/0 R+ 12:16 0:00 grep
>> dhc
>> When I killed all of the above processes, the problem was solved.
> And it will probably return as soon as you reboot your computer.
I agree.
> Why you just don't edit /etc/network/interfaces and set your given IP there?
> That will deal with the problem once and forever.
(I have some questions about your work setup and what you are doing,
but will skip them.)
You could add:
dhclient -r -pf /var/run/dhclient.eth0.pid -lf
/var/lib/dhcp3/dhclient.eth0.leases eth0
to the top of your script to release the dhcp lease and exit dhclient.
If you have "auto eth0" in "/etc/network/interfaces" you may also have
to add "dhclient -r eth0".
If you are willing to change your setup, you could modify
/etc/network/interfaces to:
auto lo
iface lo inet loopback
iface eth0home inet dhcp
iface eth0work inet
(dns and gateway stanzas)
And you would then issue:
ifup eth0=eth0home
or
ifup eth0=eth0work
to bring up eth0.
Reply to: