17

I'm having a DNS resolving issue that is affecting the performance of my locally hosted web site when browse it on my local machine. If I attach my network's DNS suffix to my local machine name when I go to the URL in my browser, the site has terrible load times (100+ times slower) than without the DNS suffix.

I thought I could fix this by using my hosts file to avoid the need for a lookup. I added an entry to my hosts file like this

127.0.0.1    myMachine.MyDnsSuffix

But this didn't change the load times, even after a reboot. Although it is not important to resolve this specific problem, I would really like to know why this happens.

Also, when I run nslookup on the domain myMachine.MyDnsSuffix, I notice it uses my network's DNS server to find the IP. Could this be related to my problem or am I just mis-understanding how nslookup works?

5 Answers5

26

I believe nslookup is used to test a DNS server itself, as opposed to utilizing your HOSTS file. http://support.microsoft.com/kb/200525 seems to indicate as much.

Try just a simple ping. Does ping myMachine.MyDnsSuffix resolve to the loopback address you have specified in your HOSTS file?

8

DNS lookups do not use a hosts file. Ever.

user9517
  • 117,122
adaptr
  • 16,746
2

OK, brand new approach. Let's have you clear your IP and NETBIOS cache. ipconfig /flushdns and nbtstat -R. Then fire up a packet sniffer like Wireshark, and do a ping while it's running.

From the packet capture, we want to see if A) There's a DNS request going out, and if so, what name is it requesting. B) If there's a NETBIOS request going out. It's possible this name is being resolved via NETBIOS instead of proper DNS.

If we don't see either of the above despite you flushing your cache, then it's likely that the name is being pulled from either hosts or lmhosts.

1

Some people on web forums claim that creating a new hosts file and restarting the DNS client service fixes the problem, but I'm not sure why that would work if you've already tried rebooting.

I realize this is a longshot, but there aren't any Microsoft-related words like MSDN, Microsoft, or MSN in the hosts file entry, are there? Microsoft has written dnsapi.dll to ignore hosts file entries matching certain names. For example, if I add the following entry, Windows skips it and resolves both hostnames in the entry using DNS:

127.0.0.1 www.microsoft.com www.mysite.com
jlupolt
  • 944
0

When using the full DNS name your browser is attempting to go through your proxy server - clicky for IE.

The hosts file or name resolution order is nothing to do with this problem, and the festering sore on the backside of humanity that is the hosts file should be taken out back and noisily shot.