2

I've got a linux box with a static IP configured that seems to be ok. The static IP address works for a few hours, and then sets itself back with (what seems like) whatever DHCP tell it to use.

Here's my /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.0.0.101
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.254

Any ideas?

4
  • You could ask this in askubuntu.com or unix.stackexchange.com and get better/faster answers
    – Toto
    Commented Oct 29, 2010 at 18:20
  • I believe this is my problem: superuser.com/questions/99034/…. Gnome is trying to manage my network for me. Thanks for the suggestion though.
    – slim
    Commented Oct 29, 2010 at 18:49
  • 1
    This looks like NetworkManager acting up. Do you have NetworkManager running? Do you want to? Commented Oct 30, 2010 at 0:25
  • That's what the problem was. I disabled the Gnome networking and it's been ok. Thanks for the help.
    – slim
    Commented Nov 14, 2010 at 4:44

2 Answers 2

1

I got the same problem on Ubuntu Server, but I think I managed to solve it. When I restart networking, dhclient3 is still running. Looking at it from htop, it has some “eth0″ in the arguments, so I suspected it was still looking for renewals of dhcp for eth0. I failed to remove dhcp-client with apt-get, so I ran:

sudo kill $(ps -aux | grep dhc | grep eth0 | awk '{print $2}')

NOTICE: This code might kill other things on your server! Take it easy and replace “eth0″ with the interface name for which you have set a static IP! Alternatively kill dhclient OR dhclient3 for your interface through htop.

0

I've had the same issue. The dhclient daemon is insane. The sanity checks need work. It should go something like this:

  • Discover existing lease information (/var/lib/dhcp/*)
  • Validate all interfaces for DHCP configuration (/etc/network/interfaces)
  • If an interface is statically configured then clear DHCP lease information and ignore the interface for the duration of the execution.
  • If an interface is not statically configured and has existing lease information, then renew accordingly.
  • If an interface is not statically configured and does not have existing lease information, then discover accordingly.

HISTORY --------------------------------------------------------------

While the issue was ongoing I witnessed /var/log/syslog fill up with the following line:

May  3 06:25:36 xxxxxx dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67

The dhclient process was running in the background as confirmed with 'ps aux | grep dhc'

Having confirmed correct static IP setup for eth0 in '/etc/network/interfaces', I restarted the networking service. After the networking service was restarted the static IP was maintained until the lease reached halflife, at which point dhclient renewed the previously DHCP assigned address, which was received on initial configuration of the system. This information is maintained in '/var/lib/dhcp/*'.

This behavior has been witnessed on three systems I've been working on over the last few days. System info:

# cat /etc/issue.net
Debian GNU/Linux 7
# cat /proc/version
Linux version 3.2.0-4-amd64 ([email protected]) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.68-1+deb7u1
# dhclient -version
Internet Systems Consortium DHCP Client 4.2.2

RESOLUTION -----------------------------------------------------------

Note: Perform as root or add sudo to each command.

# dhclient -r
# dhclient -x
# rm /var/lib/dhcp/* 
# shutdown -r 0

Result: The dhclient process did not automatically start with the system, 'ifconfig' shows that eth0 was correctly configured with the static IP, syslog is clear of the DHCP spam, and the change is persistent through multiple system restarts.

CAUTION: My systems are reliant on a statically assigned IP address to operate correctly. If you're applying this fix to a laptop it will likely break wifi connectivity.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .