3

I have a webpage on a device that is access only by IP address, not by a domain name (e.g. 172.16.4.33). 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?

Ben Burleson
  • 81
  • 1
  • 1
  • 3
  • 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 03: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

2 Answers2

4

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

Jed Daniels
  • 7,282
  • 2
  • 34
  • 42
  • 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
-1

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.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
anastrophe
  • 5,488
  • 2
  • 16
  • 16
  • 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 03: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