Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome DNS lookup time local address

I'm developing a local site in Windows 7 using WAMP, with a domain of sitename.local. I have sitename.local in my hosts file poiting to 127.0.0.1. I'm getting DNS lookup times of around 6 seconds in chrome. If I immediately reload the page it's instant, but if I wait a minute and reload it I have to wait for a further 6 seconds for the DNS lookup.

My question, why is it having to do a DNS lookup if it's a local address listed in my hosts file? And is there any way I can reduce this time?

A bit of additional information, using the chrome://net-internals I can see that the cache is only ever a minute long, and when this cache expires this is what causes the lengthy lookup time. But should this really affect anything as it shouldn't need to look anything up?

like image 369
TDH Avatar asked Nov 04 '22 05:11

TDH


1 Answers

Your issue may be with the .local domain. It has special behavior. I'm not a DNS expert, but had the "pleasure" of debugging a related issue with a friend some time ago. It boiled down to trying to resolve the .local domain via multicast in the network. See a quick explanation here.

Try changing to sitename.com to force the resolution using the hosts file.

like image 108
Christian Garbin Avatar answered Nov 13 '22 05:11

Christian Garbin