Thursday, 6 February 2014

Ubuntu Server 13.1 – Basic Networking, Changing IP Address and Hostname (Post Setup 1)

Change IP address from DHCP to Static
The network interface config file is located at /etc/network/interfaces
The default setting of the interfaces file is

# 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

Modify the setting as per below after the entry iface eth0 inet.  I think the below setting is clear enough, don’t have to explain what is IP address, broadcast and gateway.

$ sudo su -

[sudo] password for xxx: (enter your password here for su to root)

$ nano /etc/network/interfaces

iface eth0 inet static








$ service networking restart

Note: The /etc/resolv.conf name server entries will be replaced/updated with the dns-nameservers setting in /etc/network/interfaces after rebooting.  Therefore, no need to modify /etc/resolv.conf with the name server entries again.


Changing Hostname and Fully Qualified Domain Name (FQDN)

The host name file is located at /etc/hostname, you can modify the entry in this file to the required hostname. Do note that you will also have to modify the hostname in  /etc/hosts file for the entry, if not your hostname and your hosts file entries will be different.

The command service networking restart doesn’t seem to update the hostname changes, best to reboot the system. 


  1. Awesome website. If you don’t want anyone to know what you are downloading including your Internet Service Provider then you should be using a VPN Service. Find the best ones here.

  2. Great to peruse the news that you have gotten your first installment. Congrats. international urdu news paper
    Do read this and Have a decent day.