Why does my name resolution hit the DNS even with a hosts file entry?
Posted
by
Volomike
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Volomike
Published on 2011-03-08T04:15:31Z
Indexed on
2011/03/08
8:19 UTC
Read the original article
Hit count: 442
I'm running Ubuntu 10.04.2 LTS Desktop. Being a web developer, naturally I created a "me.com" in my /etc/hosts file. Unfortunately, my name resolution is going out to the DNS before first checking my local hosts entry and I can't figure out why.
The end result is that if my /etc/resolv.conf contains "nameserver 127.0.0.1" in there first, then I get a response back in my web browser from me.com (local) within less than a second. But if I don't have that entry, then my response takes sometimes as much as 5 seconds if my ISP is a little slow.
The problem was so troublesome that I actually had to file a question here (and someone resolved it) for how to automatically insert that entry into /etc/resolv.conf. But one of the users (@shellaholic) here highly recommended (and commented back and forth with me about it) that I should file this question.
Do you know why my workstation's name resolution has to hit the DNS server first before hitting my /etc/hosts file entry? For now, I'm using the resolv.conf trick (see link above).
© Ask Ubuntu or respective owner