This guide will cover the setting-up of a static IP address 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 your network DHCP server’s scope to avoid address conflicts.
Reboot the machine after saving.
sudo shutdown -r now
After the machine reboots, the changes can be verified with ifconfig
:
ifconfig