Ubuntu Server static IP

Easy enough? By default, Ubuntu Server is configured with DHCP enabled but we need a static IP. The following tutorial will show you just how to do that!

Let’s open the interfaces configuration file.

sudo nano /etc/network/interfaces

It should look like the following.

auto eth0
iface eth0 inet dhcp

DHCP is currently set but we need a static IP. The following configuration will show what needs to be changed and add.

auto eth0
face eth0 inet static
        address 192.168.1.4
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        dns-nameserver 192.168.1.2 192.168.1.1

In previous version of Ubuntu you needed to edit the /etc/resolv.conf and add a line. This is no longer the case.

I hope this tutorial helped!