Set static IP Ubuntu 16.04

Changing Ubuntu Server from DHCP to Static IP Address (Ubuntu Server 16.04 TLS)

Recently, created a couple of LAMP stacks with Ubuntu 16.04 and needed to issue a Static IP so that it could be NAT’d as a web server.

I have used this command
Step 1.

sysadmin@ubuntu:~$ sudo nano /etc/network/interface

auto ens160
iface ens160 inet dhcp

Step 2. Change dhcp to static and edit the IP Address/Subnetmask/Gateway (in bold)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

 # The primary network interface
auto ens160
iface ens160 inet static
dns-nameservers (or Internal DNS Servers)

Step 3. Now restart the networking service

sysadmin@ubuntu:~$sudo service networking restart

This seems to do the trick for our Ubuntu Server 16.04 TLS. Try it out.



How-to-Geek (2016). Change Ubuntu Server from DHCP to a Static IP Address. Retrieved from:


Ubuntu Official Help Documentation (2016). Network Configuration. Retrieved from:

Follow Us On
fb-art Postwaves


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s