ASNs by country using IP geolocation (not only by RIR registration)?

Hey everyone

I’ve been testing some IPs and noticed that a few ASNs clearly located in specific countries don’t appear when I check the country ASN lists
For example, both of these IPs are located in Bahrain according to IPinfo:

{
  "ip": "38.54.2.12",
  "city": "Manama",
  "country": "BH",
  "asn": {
    "asn": "AS138915",
    "name": "Kaopu Cloud HK Limited",
    "domain": "kaopucloud.com",
    "route": "38.54.2.0/23",
    "type": "hosting"
  }
}

{
  "ip": "15.185.237.11",
  "city": "Dār Kulayb",
  "country": "BH",
  "asn": {
    "asn": "AS16509",
    "name": "Amazon.com, Inc.",
    "domain": "amazon.com",
    "route": "15.185.0.0/16",
    "type": "hosting"
  }
}

But when I check the ASN list for Bahrain using the RIPE API:
https://stat.ripe.net/data/country-resource-list/data.json?resource=BH

and also through IPinfo:
https://ipinfo.io/api/data/asns?country=bh
or
https://ipinfo.io/countries/bh#section-asns

These ASNs don’t show up… just wanted to confirm if these endpoints only return ASNs registered under that country’s RIR or if there is a way to list ASNs detected by IP geolocation instead of registration origin.

Hi JDarzan,

The ASN country information is the organization’s registration country. An ASN can be registered in one country, but have IP addresses all over the world.

 $ ./asnsummary.sh AS138915


Summary
- Total   186880
- Unique  186880
- Anycast 0
- Bogon   0
- Mobile  0
- VPN     7260
- Proxy   5
- Hosting 184320
- Tor     2
- Relay   0

Top ASNs
- AS138915 Kaopu Cloud HK Limited 186880 (100.0%)

Top Usage Types
- Hosting  168960 (90.4%)
- Business 16128 (8.6%)
- ISP      1792 (1.0%)

Top Routes
- 211.155.96.0/22 (AS138915)  1024 (0.5%)
- 154.95.104.0/22 (AS138915)  1024 (0.5%)
- 154.95.100.0/22 (AS138915)  1024 (0.5%)
- 154.95.72.0/22 (AS138915)   1024 (0.5%)
- 211.155.100.0/22 (AS138915) 1024 (0.5%)

Top Countries
- Hong Kong     26625 (14.2%)
- United States 15360 (8.2%)
- Singapore     12048 (6.4%)
- Taiwan        7680 (4.1%)
- France        6504 (3.5%)

Top Cities
- Hong Kong, Hong Kong, HK                   23428 (12.5%)
- Singapore, Singapore, SG                   12048 (6.4%)
- Mountain View, California, US              9384 (5.0%)
- Taipei, Taiwan, TW                         7168 (3.8%)
- Marseille, Provence-Alpes-Côte d'Azur, FR  6504 (3.5%)

Top Regions
- Hong Kong, HK                   23428 (12.5%)
- Singapore, SG                   12048 (6.4%)
- California, US                  9384 (5.0%)
- Taiwan, TW                      7168 (3.8%)
- Provence-Alpes-Côte d'Azur, FR  6504 (3.5%)

Top Privacy Services
- giampingsocks5 91 (0.0%)
- metrovpn       54 (0.0%)
- ufovpn         31 (0.0%)
- ZoogVPN        18 (0.0%)
- blinevpn       18 (0.0%)

Top Domains
- asianet.co.th   256 (0.1%)
- speakeasy.net   249 (0.1%)
- netsourceva.com 2 (0.0%)
- challalaw.com   1 (0.0%)

One way to get the registered country of the ASN is through our ASN API service:

$ curl https://ipinfo.io/AS138915?token=$TOKEN | jq .country

"HK"

Please, let me know what you think. Thank you. I really appreciate it.

1 Like