Setting a static IP Address on Ubuntu Server 14.04

image_pdfimage_print

This process uses the command line to set a static IP address on Ubuntu Server 14.04.

Note: If you do this process from an SSH session, you will lose connection when you enter the final command. But if you did everything correct, you simply need to establish a new session using the static IP address you assigned.

sudo nano /etc/network/interfaces

This is what the default file will look like:

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

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

This similar to what should look like for a static IP. Of course, use addresses relevant to your network:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 10.5.1.33
        netmask 255.0.0.0
        gateway 10.5.1.254
	dns-nameservers 10.5.1.2 208.67.222.222 8.8.8.8

Lastly you need to reload networking:

sudo ifdown eth0 && sudo ifup eth0
Share this post... Tweet about this on TwitterShare on Facebook0Share on Google+0Pin on Pinterest0Share on Reddit0Share on StumbleUpon0