How to find out all IP ranges belonging to a certain AS?

They're listed online with related details at http://ipinfo.io/AS714 (replace the ASN to get the equivalent details for any other ASN).

If instead of browsing them you'd rather grab them programmatically you can use the RADb whois server:

$ whois -h whois.radb.net -- '-i origin AS714' | grep -Eo "([0-9.]+){4}/[0-9]+" | head
17.108.0.0/16
17.106.0.0/15
17.102.0.0/16
17.207.0.0/16
17.216.0.0/16
17.250.48.0/24
17.252.65.0/24
192.35.50.0/24
17.148.0.0/14
17.86.0.0/17

Ok, I just found one simple way. You just put this http://bgp.he.net/[ASXXX]#_prefixes in your browser, where [ASXXX] is a certain AS and a number like this http://bgp.he.net/AS714#_prefixes.


For anyone else who finds this - I really liked Ben Dowling’s answer. However according to:

http://www.radb.net/support/query2.php

There is a different way which also yields very different results! I was testing a facebook IP which didn't come up in Bens' | head results. According to the above link the correct way of querying for IP4 addresses would be:

whois -h whois.radb.net '!gas714'

Equally as nice is the fact you can now find all IP6 addresses with:

whois -h whois.radb.net '!6as714'

As I say - when I ran this for the Facebook ASN I found my missing IP address.

Later update

Unfortunately Radb.net does not give out the correct data!! Try ASN 19281 for example and you'll see results given but if you simply whois radb.net with no parameters it will say “No records found.” It doesn't seem accurate enough IMHO.