12

How do I find what autonomous system number or name an IP address belongs to?

Could I find it using Ubuntu's dig command?

2 Answers 2

19

Under what autonomous system number or name that an IP is located? How to find it using "dig" command in Ubuntu?

dig is a DNS client and DNS doesn't contain any information about Autonomous System Numbers. However, you can use 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.

whois_query Click to zoom in on the image

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.

3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .