I have a webpage on a device that is access only by IP address, not by a domain name (e.g. The page performs a few ajax calls to the same server, and I noticed in firebug some of these calls show a non-zero DNS lookup time.

If no domain name needs to be translated into an IP address, why is any time taken for DNS lookup at all?

  • This sometimes occurs if the IP address is entered in such a way that the application doesn't immediately recognise it as such and treats it as a string which needs to be looked up. – John Gardeniers Jul 20 '11 at 3:08
  • @John Not sure what that means, or how one enters an IP address as a URL not as a string, but all these ajax calls are using page-relative URLs. – Ben Burleson Jul 21 '11 at 17:21
  • test this by temporarily changing the relative URLs as absolutes and let us know the results. – John Gardeniers Jul 21 '11 at 22:06

There could be links in the page that point to domain names, or there might be reverse lookups happening.

| improve this answer | |
  • There are links to hosted js and css, but the timeline I'm concerned about is specifically for an ajax call to the current page's server that shows DNS lookup times up to 250ms. I'm not sure how a reverse DNS lookup would get in there. I guess that would be jQuery doing way more than requested, which is possible. – Ben Burleson Jul 21 '11 at 17:24

Add the IP in question to the /etc/hosts file on any/all machines that will be accessing it. At minimum it would eliminate any dns lookup overhead.

| improve this answer | |
  • 1
    The use of the hosts file creates an ongoing maintenance issue and should only very rarely be required. It also wouldn't help in this case because the hosts file won't even be used. – John Gardeniers Jul 20 '11 at 3:06
  • that's arbitrary. the 172.16.x.x range is private IP space; unless he's running his own internal private dns, it needs to be added to the hosts file to mitigate failed dns lookups for unmapped space. the hosts file is not implicitly a maintenance issue - it entirely depends on the scope of the infrastructure. – anastrophe Jul 20 '11 at 20:39
  • let me rephrase - 'it may help to add it to the /etc/hosts file'. the need is not established. – anastrophe Jul 20 '11 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.