Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to know what IP ranges are belonging for example to the AS714.

How do I get this information?

I know how to do the reverse way, which is easy with whois. But the other way doesn't seem to be that easy.

share|improve this question
    
Do you want IP address ranges that originate on this AS? (Direct customers who don't have an AS) What about IP address ranges only reachable through this AS? (Customers that have their own AS.) What about IP address ranges reachable through this AS but also other provider ASes? (Multihomed customers.) – David Schwartz Mar 28 '12 at 10:06
    
The purpose was to find out all the IP ranges my provider owns. I got this info by visiting bgp.potaroo.net/as1221/asnames.txt in order to find out the AS number and ripe.net/data-tools/stats/ris/routing-information-service in order to get all the IP ranges through the prefixes tab. Do you know other possibilities? – JohnnyFromBF Mar 28 '12 at 11:01
up vote 5 down vote accepted

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.

share|improve this answer

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
share|improve this answer

I found that you can't really automate queries to bgp.he.net, I kept getting 403 responses, and then when I faked a user agent, it tried to verify that I was indeed a real browser. I kind of failed in everything with bgp.he.net (even contacting the site).

What DID work for me, was to query http://ipinfo.io as Ben Dowling said in another answer.

I did a python script to get every IP block per ASN. I had a list of every AS number in a csv file. here it is:

import requests
from bs4 import BeautifulSoup
import re


url_base = 'http://ipinfo.io/'
as_base = 'AS'

output = open('ip_per_asn.csv', 'w')
with open('chilean_asn.csv') as f:
    lines = f.read().splitlines()
    for asn in lines:
        ASN = as_base + asn
        page = requests.get(url_base+ASN)
        html_doc = page.content
        soup = BeautifulSoup(html_doc, 'html.parser')
        for link in soup.find_all('a'):
            if asn in link.get('href'):
                auxstring = '/'+as_base+asn+'/'
                line = re.sub(auxstring, '', link.get('href'))
                printstring = asn+','+line+'\n'
                if 'AS' not in printstring:
                    output.write(printstring)
        print asn+'\n'

print 'script finished'

That said, you can also use curl with ipinfo.io. Just try to be polite and don't make absurdly large queries to the servers.

share|improve this answer

You must log in to answer this question.

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