Ubuntu 12.04 network configuration

The network configuration of Ubuntu 12.04 has changed a bit, at least the server edition, haven’t checked the desktop version.

The file /etc/network/interfaces contains a few directives that tell Ubuntu how to configure the network interfaces. There are basically two choices: dynamic configuration (through a DHCP client) or static configuration. DHCP is quite simple:

auto eth0
iface eth0 inet dhcp

This tells Ubuntu to use a DHCP client to query for network configuration information from a DHCP server located somewhere on the local network. The interface is configured (eth0 in this example) and DNS information is written to /etc/resolv.conf.

In previous versions of Ubuntu (before 12.04) you could put static DNS information in this file if you used static network configuration. The only problem with this setup was when you accidentally activated a DHCP client and the file was overwritten, thereby losing your static information. In Ubuntu 12.04 you are no longer supposed to edit the file /etc/resolv.conf, but need to add the DNS information to the /etc/network/interfaces file.

iface eth0 inet static
   address 10.0.0.100
   netmask 255.255.255.0
   gateway 10.0.0.1
   dns-nameservers 10.0.0.2

This information is then used to generate the /etc/resolv.conf file with the following content:

nameserver 10.0.0.2

3 thoughts on “Ubuntu 12.04 network configuration

  1. Permalink  ⋅ Reply

    KRISHNA

    June 19, 2013 at 11:10pm

    Thanks for sharing the information, it helps me a lot for setting my Ubuntu network

Leave a Reply

Your email will not be published. Name and Email fields are required.