Question:
I have set an ip address for eth0 interface in Ubuntu and it worked for a while. But after sometime, the IP address is automatically removed from the eth0 interface in-spite of having the entry for eth0 in /etc/network/interfaces file.
How to solve this issue?
Solution:
It can happen if the Network Manager in Ubuntu is controlling the interfaces. Try removing the Network Manager and then restart the network service.
Why ip address gets removed automatically in Ubuntu?
If you have network-manger installed, then it might cause an issue if IP address is manually set.
Remove the Network Manager from the system:
$ sudo apt-get purge network-manager
Bring the eth0 interface up either by restarting the network service or using ifup command.
# ifup eth0
(or)
# /etc/init.d/networking restart
Since the Network Manager is removed, the IP address configured will remain as long as the entry for eth0 present in /etc/network/interfaces file.