DNS troubles with Ubuntu Server 12.04

Some customers have been having DNS issues after setting a static IP on Ubuntu 12.04.1 where the server is no longer picking up the DNS settings as it was before; this can be easily fixed by adding the following to /etc/network/interfaces after the eth0 entry:

 

dns-nameservers [ip.of.your.router]

 

e.g., for a modem/router that’s 10.1.1.1 on your local network, your /etc/network/interfaces file might 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 static
address 10.1.1.50
netmask 255.255.255.0
gateway 10.1.1.1
broadcast 10.1.1.255

dns-nameservers 10.1.1.1

Restart your network with:

 

sudo /etc/init.d/networking restart

 

…then try pinging Google or something similar and you should have success 🙂

 

It’s generally not advisable for Australians to use nameservers located elsewhere, e.g. Google’s public DNS’ 8.8.8.8 or 8.8.4.4 – some things which are unmetered by your ISP may be metered if you do so.

 

 


Posted

in

, ,

by