Simon Lehmann

Web/mobile app developer from Perth, Western Australia

Setting a Static IP Address on Ubuntu Server

09 Jul 2017

This guide will cover the installation and setup of OpenSSH on Ubuntu Server 16.04 LTS.

Edit the /etc/network/interfaces file.

$ sudo nano /etc/network/interfaces

Currently, the eth0 section may look something like this:

# The primary network interface
auto eth0
iface eth0 inet dhcp

Edit it to look like this (substitute the addresses below with your own):

# The primary network interface
auto eth0
iface eth0 inet static
  address 192.168.200.50
  netmask 255.255.255.0
  network 192.168.200.0
  gateway 192.168.200.1
  dns-nameservers 8.8.8.8

Make sure you choose an address outside the DHCP server’s scope to avoid address conflicts.

Reboot the machine after saving.

$ sudo shutdown -r now