Fresh Ubuntu install could not resolve domains names - and how I fixed it... maybe

Posted on Mon 04 May 2009 in WebDev & Code

For some time I've had trouble installing Ubuntu Server to test things. Affecting 7.10 & 8.04, but only at work and not at home. Strange. Now though, I've just figured out what the problem was, at least, I thought I had.

At work, we have a gateway/DHCP box (say: 192.168.55.254). When handing out IP addresses, it gives a nameserver IP of 192.168.55.225 first, and should that not be working 208.67.222.222 second (www.opendns.com)

When booting, the Ubuntu box created it's /etc/resolve.conf with:
nameserver 192.168.55.225
nameserver 208.67.222.222

I edited and saved that file to read:
nameserver 192.168.55.254
nameserver 192.168.55.225
nameserver 208.67.222.222

so adding the gateway as the namesever (our gateway can be the name server but I had a particular reason for not having it that way).

Rebooted, tried my 'sudo apt-get install ...' again, everything resolved and the essential updates happened. However, when looking to write this post for when I next have the same problem, I've noticed the /etc/resolve.conf file has returned to it's earlier two entries.

I'd assumed that the Ubuntu server install expects the gateway to be at the same IP as the nameserver. This is true for my home (which is why it worked at home without trouble but at work it didn't). I'm not so sure now, maybe it was just rebooting a second time after the install that fixed it. At least it works.