How to edit network settings manually in Ubuntu Server 12.04 (Precise)

Changing network settings in new versions of Ubuntu (don’t know when exactly this new methodology started) like Ubuntu 12.04 Precise Server Edition, has a major difference from the old methodology.

The major change is that you no longer need to edit “/etc/resolv.conf”, and if you try to, your settings will be lost or overwritten once you reboot.

All what you need to change if you want to apply a static address (which is the case in almost all server installations) is the “/etc/network/interfaces” file.

For example:

auto eth0
iface eth0 inet static
address xx.xx.xx.xx
netmask xx.xx.xx.xx
gateway xx.xx.xx.xx
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx xx.xx.xx.xx

You will notice that everything is the same, except the last line which used to be added to the /etc/resolv.conf directly before. With this new methodology the “resolvconf” utility will automatically read the “dns-nameservers” one by one (separated by a space) and will append them to the “etc/resolv.conf” file.

After that to apply your changes, you can just do “sudo /etc/init.d/networking restart” or simply reboot your machine if you wish.


About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Ubuntu and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s