Thursday, July 14, 2011

Configuring DNS in Ubuntu

My company recently added a primary and secondary DNS server, but I was unable to resolve any of the server names to IP addresses after configuring the name servers.

The file /etc/resolv.conf contains the following

nameserver 192.168.1.164
nameserver 192.168.1.48

Which seemed perfectly reasonable, yet running a nslookup resulted in:

** server can't find mycomputer: NXDOMAIN


I instead tried a reverse lookup using nslookup, specifying the IP of the server I wished to connect to, which returned my first clue

servername.domainname.com


It appears that the domainname was required in my lookup. So I searched for servername.domainname.com and got the IP address as I would have expected.

This led me to the man page for resolv.conf, which identified the domain configuration option, and the following contents for resolv.conf

domain rocsoft.com
nameserver 192.9.200.164
nameserver 192.9.200.48


Now running nslookup servername returns the IP for the computer.

No comments: