Ubuntu 11.04 Static IP doesn't take

3

I'm trying to set a static IP address in Ubuntu 11.04. I did a server install. I edited my /etc/network/interfaces file to include:

auto eth0
iface eth0 inet static
    address 10.0.0.100
    netmask 255.255.255.0
    gateway 10.0.0.1

When I do a /etc/init.d/networking restart this appears to take. After awhile though, that 10.0.0.100 will turn into something dished out by the DHCP server.

My problem appears to be similar to this: Ubuntu intrepid - static IP networking keeps restarting with DHCP

But I don't have Gnome installed. Is there anything else that's running in the background that could be doing this? And if so, how do I disable it?

mrduclaw

Posted 2011-05-19T06:16:45.217

Reputation: 318

1Have you deactivated DHCP for you auto eth0 connection? – Michael K – 2011-05-19T07:23:15.953

Do I do that somewhere else besides the iface eth0 inet static line above? dhclient doesn't appear to be running. – mrduclaw – 2011-05-20T00:41:38.467

Answers

1

Remove or comment out the "auto eth0" line... if you are defining it as static below that line then you don't need it 'auto' in the first place.

My guess is that it is a race condition where since static can be set right NOW that is the one that gets completed first.. DHCP takes a bit longer to establish since there is a bit of server communication and hand-shaking that needs to take place, and thus when that finally completes it overwrites your already-finished-setting static IP.

I have not tested this on my machine as everything is unplugged due to a storm in my area, but this is my best untested guess.

CenterOrbit

Posted 2011-05-19T06:16:45.217

Reputation: 1 759

1

Try searching through log files. To be more specific, I have noticed that /var/log/syslog logs every IP change.

Few possible greps

grep -i eth0 /var/log/syslog

grep -i 10.0.0.100 /var/log/syslog

To search every log
grep -i eth0 /var/log/*

bbaja42

Posted 2011-05-19T06:16:45.217

Reputation: 2 815

1

If NetworkManager is installed (dpkg -l network-manager should display an entry beginning with ii), it may interfere with ifupdown settings.

Try updating /etc/NetworkManager/NetworkManager.conf, enabling ifupdown plugin and disabling managing of interfaces specified in /etc/network/interfaces.

Mine looks like this:

[main]
plugins=ifupdown

[ifupdown]
managed=false

There may be other plugins activated; you should then add them at end of plugins stanza, separating names with comma, and appending the [ifupdown] section to the end of the file.

whitequark

Posted 2011-05-19T06:16:45.217

Reputation: 14 146