How do I find the nearest large city from an IP address?
August 30, 2007 3:55 PM   Subscribe

Any reputable and inexpensive services that provide mapping from an IP address to the nearest large city?

I need to do this in bulk, so I can't just look up the location from one IP address and figure out the nearest big city. Any suggestions on sites that provide this service?
posted by Maia to Computers & Internet (7 answers total) 1 user marked this as a favorite ?
posted by ManInSuit at 4:04 PM on August 30, 2007
posted by devbrain at 5:09 PM on August 30, 2007

There's a free version of the GeoIP database here, to see how it'll work in your specific application. It is pretty much the best thing out there to do this, though of course it isn't guaranteed, since realistically IPs are only trackable down to the provider, though their pay database uses a bunch of (bought) survey data to add as much precision as they can.

There's good data for the US, Canada, Europe, South Korea, and Japan; outside of that is pretty sketchy. Russia is hit and miss as far as getting a city goes. You'll almost always be able to get at least a country from the db, though.
posted by blacklite at 5:18 PM on August 30, 2007

The easiest way to find that out is to do a tracert to the IP, and look at the names of the last few nodes along the way. Most backbone companies give their nodes names associated with their location.

For instance, the last network node on my tracert to Metafilter is "". Where do you think Metafilter's server is located? (The smart money bets on Texas.)

This doesn't invariably work, but it usually does.
posted by Steven C. Den Beste at 7:42 PM on August 30, 2007

(Sorry; I retract my suggestion. I didn't see the "in bulk" in your request.)
posted by Steven C. Den Beste at 7:43 PM on August 30, 2007

I'm not sure how, but I know caida has done this to generate maps of worm activity in papers they've published. They obviously operate in huge bulk. Their paper on the Witty worm says they use Digital Element's NetAcuity tool. I don't know if it's spendy or what, but the folks at caida are a pretty savvy bunch and I suspect they looked into free/cheaper solutions before settling on this one.

I don't know what kind of scripting (if any) you'd need to get this to actually do a bulk operation, but I think this tool is probably good if they're using it.
posted by crinklebat at 11:45 PM on August 30, 2007

I know cygwin (linux tools for windows) comes with the geo ip libraries, and they are therefore available for linux and OS X too.. you can probably write a simple program to do all that you need.
posted by mbatch at 10:50 AM on August 31, 2007

« Older Burglary experiences and what to look for   |   What kind of spider almost killed me? Newer »
This thread is closed to new comments.