How do I find the geographical location of a host, given its IP address ?
In general, it is impossible - IP addresses are allocated arbitrarily, as there's no inherent connection between an IP address and it's physical location, and there's no reliable method to do the trick.
Yet, doing some detective work could help. Try following methods :
- Note the following links for reference :
A complete list of country codes
A complete list of U.S. state abbreviation
A complete list of airport codes
- Use reverse DNS to find out the host's name. This item could supply some clues that could help.
E.g. given the IP address 184.108.40.206, the command 'nslookup 220.127.116.11' translates the address to construct.haifa.ac.il gives two hints -
- The TLD is .il, which hints the host is in Israel.
- The next two domains are haifa.ac, so this host belongs to the 'haifa' academical institute (a university, in this case). The Haifa university happens to be in the city Haifa.
Reverse DNS translation doesnt always work - it depends on the host's [the host with the given IP address] DNS server's correct configuration.
Another trick is to execute a whois request on the IP address. Try to direct the whois query to whois.arin.net - if it doesn't have the reply it will tell you to query either whois.apnic.net or whois.ripe.net
Notice that a host in one domain might be hosted in another country. This is due to both virtual hosting, where a domain of a company from one country or region, might be hosted where hosting is cheap.
Also notice that the .org, .com, and even .edu domains does not imply the host is in the U.S., as many of those domains belong to companies that are either not U.S. based, or are international, and might have some hosts all over the world.
- Some hosts support a DNS extension which allows for hosts to enter their geographical location into their DNS record, based on an extension to DNS described in RFC 1876.
For further information see - http://www.ckdhr.com/dns-loc/
Another attempt to express a host's geographical location via DNS is done in RFC 1712. Both RFCs define a DNS Resource Record to contain the geographical location.
- Visit the host's web server. A web site will sometimes contain hints regarding the site's location.
E.g. for construct.haifa.ac.il, you can find info at both http://www.haifa.ac.il/ and http://www.ac.il/
- Use whois. The whois database contains administrative contact info for all domains, filled in during domain registration time, and updated from time to time. This admin info could give some hints.
The whois database is not highly reliable - if an address belongs to a large & responsible company, the company will supply reliable info and update it, but as domain name registrators do not insist on keeping the database accurate and current, the data might be incorrect.
The Allwhois.com page allows whois requests for many countries.
A list of whois servers, collected by Matt Power, is available at https://stuff.mit.edu/afs/sipb/project/gopher-links/whois-servers.list
Note that the data is usually given for the owners' main branch or contact points, but the IP addresses might be allocated to hosts that may be located at a different location(s).
- Use traceroute. The names of the routers through which packets flow from your [or any] host to the host with the given IP address might hint at the geographical path which the packets follow, and at the final destination's physical location.
E.g. > traceroute www.mit.edu
traceroute to DANDELION-PATCH.MIT.EDU(18.104.22.168), ...
1 teg.technion.ac.il (22.214.171.124) 2 ms 1 ms 1 ms
2 tau-smds.man.ac.il (126.96.36.199) 5 ms 5 ms 5 ms
3 188.8.131.52 (184.108.40.206) 9 ms 11 ms 13 ms
4 TAU-shiber.route.ibm.net.il (220.127.116.11) 535 ms 549 ms 513 ms
5 fe7507.tlv.ibm.net.il (18.104.22.168) 562 ms 596 ms 600 ms
6 22.214.171.124 (126.96.36.199) 1195 ms1204 ms
7 nyc28-16-sar1.ny.us.ibm.net (188.8.131.52) 1208 ms1216 ms1233 ms
8 184.108.40.206 (220.127.116.11) 1210 ms1239 ms1211 ms
9 sprint-nap.bbnplanet.net (18.104.22.168) 1069 ms1087 ms1122 ms
10 nyc1-br2.bbnplanet.net (22.214.171.124) 1064 ms1109 ms1061 ms
11 cambridge1-br1.bbnplanet.net (126.96.36.199) 1185 ms1146 ms1203 ms
12 cambridge2-br2.bbnplanet.net (188.8.131.52) 1185 ms1159 ms1073 ms
13 ihtfp.mit.edu (184.108.40.206) 1052 ms 642 ms 658 ms
14 W20-RTR-FDDI.MIT.EDU (220.127.116.11) 640 ms 665 ms 674 ms
15 DANDELION-PATCH.MIT.EDU (18.104.22.168) 702 ms 915 ms 868 ms
The 3rd hop takes the path to the academic network [checked by local whois lookup], the fifth hop takes the path to New-York [on the east coast], and the 10th hop takes the path to Cambridge [in Massachusetts, on the coast, northern to New-York].
There is a utility named VisualRoute (http://www.visualware.com/visualroute/index.html) which traceroutes a host, and displays the route on a map of the world. The host's location on the map is based on the whois query, which may be wrong - an Israely domain might be displayed as being in Israel though it is hosted in another country.
- Some of the services available on the host might give further info.
E.g. telnet construct.haifa.ac.il 13 <== Time of day service
Connected to construct.haifa.ac.il.
Escape character is '^]'.
Wed Jan 21 08:32:53 1998 <== Time difference hints at the
host's time zone.
- Naming conventions of ISPs and back-bones
AT&T dialups : <port>.<router-location>.<state>.dial-access.att.net
Port is 2-254 for the dial-up ports, and 1 for the router itself. location: example: "los-angeles-2" (city and router #). state: 2-letter abbreviation.
(Thanks to D. Stussy)
uu.net dialups :
iu = intended use (meaningless), state is per USPS ZIP code, deviceis Ascend 'TNT' # or Ascend 'MAX' #.
(Thanks to Robert Bonomi)
(Thanks to John Bradshaw)
- Related sites :
The Mappa.Mundi Magazine - http://mappa.mundi.net/
Cyber Geography - http://www.cybergeography.org/
Back to my page.