I spent far too long figuring this out, and wanted to share.
Simple task: Add a static IP address to the 2nd of 4 NICs on my server.
To start, I followed the instructions here under Static IP Address Assignment: https://help.ubuntu.com/14.04/serverguide/network-configuration.html
interfaces
file:
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto em1
iface em1 inet dhcp
auto em2
iface em2 inet static
address 172.24.0.9
netmask 255.255.0.0
Then I run sudo ifup em2
, as per the instructions.
At first, it appeared to work. ifconfig
showed the interface properly, and I was able to ping devices on the network. HOWEVER, after about a minute or so, the assigned static IP address vanished. The address is lost and the machine is unreachable. This happens over and over no matter how often I bring the interface up or down. Why is this happening?
Best Answer
The issue was Network Manager. NM is supposed to ignore explicit interfaces in the
/etc/network/interfaces
file. However, it appears you need to RESTART the service:And now the static IP is not being overwritten by Network Manager. The "unmanaged" state of the 2nd interface (or whatever interface you may be working on) is what we are looking for.
tl;dr: After adding an interface to the
interfaces
file, restart thenetwork-manager
service.