Tuesday, August 27, 2013

how to fix ubuntu's dns settings

i typically use slackware and dns settings just work. whenever i try out an ubuntu vm, my dhcp-configured local dns server always partially works. for example:
$ cat /etc/resolve.conf
nameserver 192.168.1.1
search local
$ ping svnserver
PING svnserver.local (192.168.1.100) 56(84) bytes of data.
64 bytes from svn.thedeanda.com (192.168.1.100): icmp_req=1 ttl=64 time=0.627 ms
$ ping svnserver.local
ping: unknown host svnserver.local
now edit /etc/nsswitch.conf and so the hosts line looks like:
hosts: files dns
$ ping svnserver.local
PING svnserver.local (192.168.1.100) 56(84) bytes of data.
64 bytes from svnserver.local (192.168.1.100): icmp_req=1 ttl=64 time=0.271 ms
all the extra entries and the "[NOTFOUND=return]" in the middle of the line makes it give up before trying dns. i'm not sure why ubuntu does it this way. its a tricky one to find so i thought i'd share.