Do you want to know where in the world an IP address comes from? I often do and I've used a number of tools - but they tend to draw me fancy maps and lead me away from my page. So this morning I put together a cheap and cheerful "which country is this IP from?" script, using
Maxmind Open Source Technology which just produces a little popup. Oh - and if you cut and paste an IP address with leading and / or trailing spaces into it, it actually works too.

Have a play with it - it's IP6 aware too, so you can put in things like ::ffff:dc05:ca4b and find out what THAT means too!

I have coded in many (most?) of the special cases ... if you try IP addresses like ::1 or like 192.168.0.1 you should get sensible results - but please do let me know if you find anything that's not covered in IP terms. The Maxmind database is pretty darned good, but it is NOT guaranteed to get every IP address right, so if you put in your own IP address, seated in Bristol, and get told you're in France ... then chances are that you're using the connection of a French company and your packets hit the internet in Toulouse!
There's a permanent link to this utility on our front page which I invite you to bookmark and use. And you may wonder what the "distance" indicator is that sometimes comes up on your results. It's a very rough guess at the distance (in miles) that the IP address given is from our training centre, because I would love you to be remember our
training courses ... we'll teach you how to write little toys like this one on our
PHP techniques workshop, for example.
And for the more technical ...
IPv6 cases considered:
Full IP6 e.g.
65e1:763d:6652:1342:0725:4c65:1424
Shortened IP6 e.g. ::1a72:189 and
1234::17a3:712
IP4 mapped current e.g.
::ffff:64ed:54
IP4 mapped obsolete e.g.
::8c4b:430a
Teredo Tunneling: e.g.
2001:0::154a:19:a4
ORCHID: e.g.
2001:0013:64ec::879a:0:15
Documentation e.g.
2001:0db8:1342:0725::1a:74a0
Multicast e.g.
ff75:7762::
Local, Managed e.g.
fc05:8854:87::65
Local, Random e.g.
fd76:638d:c737:83ab:552c:6509:65ab:817
Site-local (deprecated) e.g.
fed5:7764:9a77::
Link-local e.g.
feab:17:18:e745::65a
Unconfigured i.e.
::0
Loopback i.e.
::1
IPv4 cases considered:
Full IP4 address e.g.
83.170.95.163
Automatic private addresses e.g.
169.254.67.128
Local class A addresses e.g.
10.1.0.16
Local class B addresses e.g.
172.18.0.7
Local class C addresses e.g.
192.168.0.1
The local class C network we use e.g.
192.168.200.215
Loopback e.g.
127.0.0.1
Class D (multicast) e.g.
224.0.0.4
Class E (experimental) e.g.
246.86.55.164
And (though it's a bit of an aside), here's the Javascript and form that I've used on this page for the popup:
<script type="text/javascript">
function popUp(myURL) {
day = new Date(); id = day.getTime();
window.open('', id, 'height=308,width=250,scrollbars=1,
toolbar=0,location=0,statusbar=0,resizable=0,menubar=0');
myURL.target=id; return true; } </script>
<form method=GET action="/resources/iptool.html"
onSubmit="popUp(this)"> Ask about ip: <input name=ip
size=31 value="83.170.95.163"><input type=submit value=go!>
</form> (written 2009-01-04 09:40:01)
Associated topics are indexed under
Q777 - Object Orientation and General technical topics - Technology Overviews [2607] Answers on Ruby on Rails - (2010-01-30)
[1513] Perl, PHP or Python? No - Perl AND PHP AND Python! - (2008-01-20)
J808 - Java - Network Programming
Some other Articles
MichelleLooking forward, in Melksham, in 2009From spam to mod_alias - finding resourcesGoing round the blockWhere is this IP address, IPv4 and IPv6Well House Manor Hotel - on plan for 2009 business guestsMoving a directory on your web siteRequired RequestPettifog and forum boards away from public viewTelling Google which country your business trades in