Traceroute – How Does the Lookup Work?

peeringtraceroute

How does the traceroute -A command work? How does the program look up the ASN? On which protocols or databases does the query depend? Can I recreate the -A option?

I am using this version: Modern traceroute for Linux, version 2.0.18, Jun 30 2012.

Best Answer

A whois query is made for every IP returend.

Here is a manual example. Get one of the IPs of networkengineering.stackexchange.com

> host networkengineering.stackexchange.com
networkengineering.stackexchange.com has address 104.16.12.128
networkengineering.stackexchange.com has address 104.16.14.128
networkengineering.stackexchange.com has address 104.16.15.128
networkengineering.stackexchange.com has address 104.16.13.128
networkengineering.stackexchange.com has address 104.16.16.128

And check which AS the IP belongs to:

 > whois 104.16.12.128  | grep -i origin
 OriginAS:       AS13335

Whois outpus way more information. The protocol ist specified in RFC3912

Note that whois output of the regional registries differ and not all will provide the origin as. So traceroute -A will not provide AS informations for all addresses.