How to set a static IP in Ubuntu 14.04 server

By default the Ubuntu 14.04 server sets the interface to use DHCP, here’s how to set a static IP address.

Edit “/etc/network/interfaces”. In this example set-up we’ll use as our server IP address:

$sudo nano /etc/network/interfaces

Find and comment the (default) DHCP entry. Your “interfaces” file should look like this:


# 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

# DHCP not needed
# iface eth0 inet dhcp
iface eth0 inet static


Save and exit.

$sudo nano /etc/resolv.conf
search mynetwork.local

Save and exit.

Edit /etc/hosts

$sudo nano /etc/hosts
Add: u1404server.mynetwork.local u1404server

Save and exit:

Reload (start and stop) network
$sudo ifdown eth0 && sudo ifup eth0

Note: There is a bug (feature?) in 14.04 where “service networking start|stop|restart” does nothing. This command/script worked in 13.10/13.04/12.04, however it doesn’t work in 14.04.

To revert back to the 13.10 networking scripts go to:

This will replace the 14.04 scripts with the one used in 13.10.

$sudo apt-get install git
$sudo git clone
$cd restore_networking/
$sudo ./

miguel@u1404server:~$ sudo service networking restart
networking stop/waiting
networking start/running


您的电子邮箱地址不会被公开。 必填项已用*标注