How do I find what autonomous system number or name an IP address belongs to?
Could I find it using Ubuntu's dig
command?
Under what autonomous system number or name that an IP is located? How to find it using "dig" command in Ubuntu?
However, you can use dig
is a DNS client and DNS doesn't contain any information about Autonomous System Numbers.whois
to query for this purpose.
Syntax: whois -h whois.cymru.com " -v [IP_ADDR]"
It helps to use quotes and put a space in front of the -v
option.
UPDATE in CY 2022:
I'm not sure how long cyrmu has ASN info available through DNS records, but they obviously do now. I lined-through my DNS ASN answer above. Please refer to this answer to get ASN info via dig
from cymru.
Yes you can with (free) services like cymru.com
.
For instance, to query the IP 216.90.108.31
with dig
:
dig +short 31.108.90.216.origin.asn.cymru.com TXT
The result would be:
"23028 | 216.90.108.0/24 | US | arin | 1998-09-25"
Where 23028
represent the ASN
EDIT
BTW if you wanna just the AS number:
$ dig +short 31.108.90.216.origin.asn.cymru.com TXT | tr -d \" | cut -d\ -f1
23028