Skip to main content

How to Disable Network Manager and Configure static IP address on Ubuntu 16.04 LTS?

Static configurations usually need IP addresses as well as DNS resolvers plus routing. In this tutorial, we will cover Linux static configuration on Ubuntu 16.04.
Note: We have three(03) networking interfaces including 
etho0 = ipv4
eth1 = private LAN & eth2 = ipv6 .
Step 1. Edit the /network/interfaces file
# vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        gateway 94.37.X.1

auto eth1
iface eth1 inet dhcp

auto eth2
iface eth2 inet6 auto
Step 2. Restart the networking service (or reboot)
Once you are confident the change has been made, and if you don’t want to reboot you can just restart the networking service.
# sudo /etc/init.d/networking restart
After doing this, and provided you don’t get any errors, your primary network interface should now be configured with the static IP address details you have provided.

Failing that, a reboot will also do the trick quite nicely, and with the current version of 16.04 I suspect there’s a bug that is causing “ifconfig -a” not to update unless you perform a reset.
# sudo reboot
Good luck, and may your boxen be correctly addressed.

Troubleshooting: Can’t Resolve Hostname

the resolv.conf file is used to resolve DNS requests. Manually editing the resolv.conf file to configure name resolution will only do so temporarily. The Network Manager controls this essential /etc/resolv.conf file to create permanent changes. So, we’ll first stop and disable the Network Manager:
# chkconfig NetworkManager off 
# service NetworkManager stop
# systemctl stop NetworkManager
# systemctl disable NetworkManager
On Ubuntu 18.04 LTS
To verify that the new DNS resolvers are set, run the following command:
# systemd-resolve --status | grep 'DNS Servers' -A2