I have an /etc/network/interfaces
file (on a 16.04 box) that looks like this:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.88.50
netmask 255.255.255.0
gateway 192.168.88.1
dns-nameservers 192.168.88.1
dns-domain mynet.lan
You'd expect this to result in eth0
coming up with the specified IP. That is not happening. During boot, I see a line that says:
IP-Config: eth0 hardware address e0:db:55:0c:34:7e mtu 1500 DHCP
..and then the interface is brought up with an address ever-so-helpfully provided by the local DHCP server.
More troubling, this IP-Config line only shows during boot and is not visible in any of my log files.
What is IP-Config, why is it stomping on my interfaces
file, and where can it be configured?
More info:
The bogus address (in my case, 192.168.88.222) is only created during boot, sometime before the if*
scripts get to it. ip addr
shows the wrong address (gleaned from DHCP) directly above the right address (which is marked as "secondary").
tl;dr: Something is broadcasting for DHCP and assigning it to the NIC before they're brought up normally using the if*
commands, leading to two addresses on the same NIC.
If I down the interface, ip address
shows the bogus address still associated with the NIC. If I issue an ip address flush eth0
, the bogus address is removed, and does not come back on a subsequent interface restart - but it does come back when the system is rebooted.
I finally found what was causing this. Not by finding a hidden pointer to it somewhere, no, but rather by grepping my entire filesystem for DHCP settings:
grep -ri 'dhcp' /
. There's almost certainly a better way. But anyways:Earlier attempts at playing around with ISCSI netbooting on this machine somehow led to the creation of a
/run/network/dynamic-interfaces
file, which appears to use the same syntax as/etc/network/interfaces
. Sure enough, therein was the line telling the machine to bring up eth0 as DHCP, and since this is happening in the context ofinitramfs
, it's bringing the interface online long beforeiftools
gets a chance.This file is part of the
cloud-initramfs-dyn-netconf
package which is standard on Ubuntu server. You don't want to uninstall it since it's part of theubuntu-server
metapackage (and if you uninstall that, upgrades might fail in the future)After clearing the file and rebooting, the NIC is controlled by the
interfaces
file as normally expected.I believe the correct wording is static; not manual. As well, have you determined that the address you have selected, 192.168.88.50, is outside of the range of addresses used for DHCP in the router so as to avoid a collision? Perhaps x.50 is already in use or reserved.
After determining the DHCP pool in the router, I suggest that you amend the file to:
...where zz is an address outside of the DHCP pool.
Restart the interface:
The -v for verbose should produce output that tells us if the connection was successful.
Did you get the requested address?