Mapping IP addresses to AS numbers and countries

When network engineers analyze log files, collect packets or observe traceroute data, they sometimes want to know the AS that announces a given IP address. This information can be extracted from BGP routing tables to by using services such as RIPE RIS or RouteViews. There is now an interesting alternative with the https://iptoasn.com website that provides both files containing the mappings between IP addresses and AS numbers and an API to retrieve this mapping.

iptoans.com

The API is easy to use on the command line and returns a JSON object which can easily be parsed.

curl https://api.iptoasn.com/v1/as/ip/9.9.9.9
{"announced":true,"as_country_code":"US","as_description":"QUAD9-AS-1 - Quad9","as_number":19281,"first_ip":"9.9.9.0","ip":"9.9.9.9","last_ip":"9.9.9.255"}

This blog post was written to inform the readers of Computer Networking: Principles, Protocols and Practice about the evolution of the field. You can subscribe to the Atom feed for this blog. These notes are also posted on the e-book Facebook page

Written on September 26, 2019