Country Lookup
We’re pleased to announce a new service; CC2ASN – Country Lookup. This service will provide you with AS-numbers, IPv4 and IPv6 prefixes belonging to a specific country. The data is all based on publicly available information from the five RIRs in the world; ARIN, RIPE NCC, APNIC, LACNIC and AfriNIC. The database is updated once every day.
As input to this service, use ISO-3166-1 alpha-2 country codes (more info). Note that in addition to the ISO defined codes, the following two codes are also used when dealing with multi-regional networks; AP (asia-pacific) and EU (european union).
You may access the data either through the web-interface, or via your command line interface. A standard whois client can be used when the result set is “not too large”. The preferred way is to use a raw socket tool, like netcat. Here are some examples illustrating both ways:
whois -h atari.honeynor.no no
whois -h atari.honeynor.no ipv4 ke
echo "all us" | nc atari.honeynor.no 43
The first will list all AS-numbers registered for Norway, while the second example will list all IPv4 prefixes for Kenya. The last line uses netcat to fetch everything (ASN, IPv4 and IPv6) registered for USA (this query will fail when using a standard whois client).
For more information, please read the documentation (There are some caveats to be aware of, and more alternatives to download this data. It’s all in the docs).

July 9th, 2009 at 08:08
Is there a possibility to search for AS number with a return of ipv6 and ipv6 numbers for that specific AS number?
July 9th, 2009 at 14:51
No, this is not within the scope of this service. I’m not aware of any publicly accessible “ASN2IPv6″ services.
July 9th, 2009 at 16:33
But do you know of any ASN2IPv4 services then?
July 9th, 2009 at 19:30
Sure. Robtex provides a web-based tool: http://www.robtex.com/as/as21000.html#bgp. Another one is located at https://www.dan.me.uk/bgplookup?asn=21000. (AS21000 was simply used as an example here).
July 9th, 2009 at 19:36
Thnx, see you in November. ;-)
September 25th, 2009 at 09:28
I will see if I can obtain some IPv6 BGP feeds, and modify my bgplookup tool to include IPv6 too.
Give me a couple of weeks :-)
September 26th, 2009 at 23:05
Ok, my BGP lookup tool now lists both IPv4 and IPv6 prefixes.
There’s no way to ask for a specific type right now, but it’s simple… if you only want IPv6 prefixes, only select items that contain “:” – if you only want IPv4 prefixes, only select items that contain “.” :-)
Enjoy.
September 26th, 2009 at 23:35
Daniel, very nice!
March 23rd, 2010 at 22:51
[...] over 9 months we’ve run our CC2ASN service, allowing you to lookup up ISO-3166 country codes and get back [...]