Static IP Configuration on Ubuntu 16.04

Estimated reading time: 1 min

There are two methods to assign network configuration to a device on the net. DHCP or static assignment. DHCP is normally set as default. 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.

The first step is to edit this file /network/interfaces

sudo nano /etc/network/interfaces

You need to remove the “dhcp line” and add your own address, netmask, gateway and dns nameserver.

auto ens160
iface ens160 inet dhcp

iface  inet static
	address 192.168.100.50
	netmask 255.255.255.0
	gateway 192.168.100.1

Adding Snel.com DNS server’s:

dns-nameserver 89.207.128.252 89.207.130.252

If you want to reboot your system:

sudo reboot

and for restarting, in case you do not want to reboot:

sudo /etc/init.d/networking restart

Now you are all set to go with the static IP address details you have provided.

Was this article helpful?
Dislike 0
Views: 43

Reader Interactions