views:

19

answers:

2

When browsers look up hostnames, do they do that even when the "host name" is an IP address? For instance http://74.125.39.105/ goes to some Google servers. Will this result in a DNS lookup on common browsers and platforms, such as Safari, IE, Firefox, Chrome, Opera, Windows, Linux, Mac OSX?

Or will the browser (in the common case) just start a connection directly without trying a DNS lookup first?

+2  A: 

There is no DNS lookup done if the entire host part is numeric in nature. It could be in dotted quad format, or a single unsigned 32 bit integer. I haven't tested IPv6 yet.

bluesmoon
Single unsigned 32 bit integer? What does such an address look like?
Amigable Clark Kant
eg, if your IP is 10.0.0.1, then just write the bits of each number side by side, and you get the 32 bit number, so you basically have:00001010.00000000.00000000.00000001which is 00001010000000000000000000000001which, in decimal is 335544320 (if I've done my math right)
bluesmoon
No, it's 167772161 :) 74.125.39.105 becomes 1249716073 (so in some browsers you can visit http://1249716073/ and it'll take you to Google).
SimonJ
Thanks, @SimonJ.
Amigable Clark Kant
+1  A: 

There's no point in performing a lookup as there are no authoritative DNS records for these numeric "names".

Some recursive nameservers (e.g. dnscache) will respond to these kind of queries with the corresponding IP address, as if there was a real record of the form:

74.125.39.105. IN A 74.125.39.105

but this is, I assume, intended to deal with simplistic clients that assume everything is a DNS name. The most common nameserver, BIND, doesn't have this behaviour though - so don't rely on it.

SimonJ
Thanks! I had an idea some resolvers would answer, but also wanted to know how common it is to actually ask the DNS query for IP addresses.
Amigable Clark Kant