DNS fix for local name resolution
Posted: Mon Sep 14, 2009 11:43 am
I have been troubleshooting various DNS issues on my local network this week, and I made an observation that may help other folks who want local DNS resolution working on their router.
My router is set to use DHCP on my wireless LAN. I am using a hacked Linksys router running DD-WRT, which allows you to set local hostnames via dnsmasq. So instead of trying to remember IP addresses, I can ping each of my computers via their assigned hostname instead. Handy.
I noticed that I could ping hostnames outside of my network (ie. google.com), but not hosts on the local LAN (ie. macbook or macbook.home). When I looked at the contents of the /etc/resolv.conf file, I saw:
I'm not sure why this wasn't being set correctly, but it turns out that /etc/resolv.conf is actually a symbolic link to /tmp/resolv.conf. In the same directory, there is also /tmp/resolv.conf.auto, which contained:
which are the correct settings for my LAN.
I simply deleted the symbolic link and created a new one to resolv.conf.auto instead:
and now DNS resolution for hosts on my local LAN is working as it should, even after a reboot. I'm not sure if this is the right way to fix this (the symbolic link may be erased by a script later), but it seems to be working for me.
My router is set to use DHCP on my wireless LAN. I am using a hacked Linksys router running DD-WRT, which allows you to set local hostnames via dnsmasq. So instead of trying to remember IP addresses, I can ping each of my computers via their assigned hostname instead. Handy.
I noticed that I could ping hostnames outside of my network (ie. google.com), but not hosts on the local LAN (ie. macbook or macbook.home). When I looked at the contents of the /etc/resolv.conf file, I saw:
Code: Select all
nameserver 127.0.0.1
Code: Select all
search home
nameserver 192.168.24.1
I simply deleted the symbolic link and created a new one to resolv.conf.auto instead:
Code: Select all
ln -s /tmp/resolv.conf.auto /etc/resolv.conf