How to set a static IP address on Ubuntu 14.04 server (and others)

This assumes you want to set a static IP address on the network device eth0.

Open up the interfaces file

sudo nano /etc/network/interfaces

and remove or comment out the line that says

iface eth0 inet dhcp

then add the following lines in its place:

iface eth0 inet static
address [static IP address, i.e. 192.168.1.123] netmask [i.e. 255.255.255.0] network [i.e. 192.168.1.0] broadcast [i.e. 192.168.1.255] gateway [i.e. 192.168.1.1] dns-nameservers [i.e. 8.8.8.8]

Save the file and reboot the server. On some systems you may also need to update /etc/resolv.conf and /etc/hosts



1 Trackback / Pingback

  1. Static IP setup in Trusty | 0ddn1x: tricks with *nix

Leave a Reply

Your email address will not be published.


*