CC2ASN
Country code in.
Networks out.
A lookup service for AS numbers and prefixes belonging to any given country in the world. Simply provide country codes as input and you’ll get all ASNs, IPv4 or IPv6 addresses registered to that country.
api.cc2asn.com/ALL/IS
- AS numbers
- 86
- IPv4 prefixes
- 176
- IPv6 prefixes
- 72
5.23.64.0/19
31.15.112.0/21
31.43.172.0/23
31.209.136.0/21
31.209.144.0/20
31.209.192.0/18
37.152.64.0/21
37.156.68.0/24
37.205.32.0/21
37.228.128.0/24
37.228.129.0/24
45.135.209.0/24
45.151.214.0/24
46.22.96.0/20
46.28.152.0/21
46.182.184.0/21
46.239.192.0/18
62.145.128.0/19
77.73.33.0/24
78.40.248.0/21
79.171.96.0/21
80.248.16.0/20
- Dailyfive registries
- Free100 queries daily
- curl or whoisno sign-up
Straight from the registries
AFRINIC, APNIC, ARIN, LACNIC and RIPE NCC publish who holds which numbers. CC2ASN fetches each file daily, checks its MD5 sum and files every record by country.
One line per allocation
The country is the key
Addresses become a prefix
Filed under NO, IPv4
delegated-ripencc-extended-latest
ripencc|ES|ipv4|2.136.0.0|524288|20101105|allocated
ripencc|IR|ipv4|2.144.0.0|262144|20101022|allocated
ripencc|NO|ipv4|2.148.0.0|262144|20101022|allocated
ripencc|ES|ipv4|2.152.16.0|4096|20101103|allocated
ripencc|ES|ipv4|2.152.42.0|512|20101103|allocated
- Country
- NO, Norway
- Type
- IPv4
- Addresses
- 262,144 from 2.148.0.0, a /14
2.148.0.0/14in NO_IPV4
The words, briefly
- AS number
-
An autonomous system is a group of networks run under one routing policy, usually by an internet provider, a company or a university. Its number, the ASN, is a 16- or 32-bit integer, written plain (
65551) or dotted (1.15). - Prefix
-
A block of IP addresses, also called an IP range or IP block, written as its first address, a slash and the number of fixed bits:
192.0.2.0/24holds 256 addresses. Registries list IPv4 space as a start and a count, which CC2ASN turns into prefixes. IPv6 space is listed as a prefix already. - Country code
-
The two-letter ISO 3166-1 alpha-2 code the registry has on file for the holder, such as
NOfor Norway. Territories have codes of their own:SJfor Svalbard and Jan Mayen,PSfor Palestine.
Where it helps
Pick a use case to see how a country’s networks help.
Security
Networking
Research
Geo-blocking
Load a country’s IPv4 and IPv6 prefixes into a firewall set to block or allow the whole country in one rule.
Change one word, get the full list
Swap ASN for ALL and the same query returns Iceland's AS numbers and both prefix lists.
two letters
Any country code the registries use, in upper or lower case.
Build your query
Your command
curl https://api.cc2asn.com/NO
Every AS number registered to NO, one per line.
| Records | HTTP path | whois, port 43 |
|---|---|---|
| AS numbers | /NO | no |
| IPv4 | /IPV4/NO | ipv4 no |
| IPv6 | /IPV6/NO | ipv6 no |
| All | /ALL/NO | all no |
Good to know
-
The registries' files are fetched every day and sorted by country. A lookup always returns the latest day.
-
No. It is the country the registry has on file for the holder. A network can be used anywhere; this is registration, not geolocation.
-
Nothing. Each person gets 100 queries a day and 30 a minute, with no account and no key.
-
No. The API serves the latest day only; dated paths answer 404.
-
You get a 404 with the path that was not found. Use the two-letter ISO 3166 codes the registries use.
-
Some whois clients stop on long answers. Send the same query with netcat:
echo ipv4 dk | nc cc2asn.com 43