How IP addresses are mapped to Autonomous System Numbers?
Note: This information is kind of RIPE-centric because that's the RIR I deal with most.
The relationships between IPs (
inet-num) and ASNs (
aut-num) are documented in public Internet Routing Registries (IRR) using Routing Policy Specification Language (RPSL). IRRs are simply whois databases which provide additional object types (
as-set, etc) to store the RPSL information. IRRs are operated by all Regional Internet Registries (RIRs such as RIPE, ARIN, etc) as well as some other parties such as RADB.
RPSL can define not just which
aut-num relates to which
inet-num objects but also the transit and peering arrangements of a given
aut-num. This information can be used to build router configurations such as with the utility RtConfig. Additionally some LIRs document their policies for accepting new peering requests and the BGP communities they make available to their peers here.
It's important to note that besides automatically configuring routers with RPSL there isn't any "magic glue" between the IRR data and what is actually happening in the wild. RPSL is a best effort practice, which should be kept up to date, but doesn't mean there's any technical barrier to announcing a route without first publicising it in RPSL.
As an example, let's see what routes are documented for the BBC website:
dan.carley@jim ~ $ whois -T route $(dig +short bbc.co.uk) % This is the RIPE Database query service. % The objects are in RPSL format. % % The RIPE Database is subject to Terms and Conditions. % See http://www.ripe.net/db/support/db-terms-conditions.pdf % Note: This output has been filtered. % To receive output for a database update, use the "-B" flag. % Information related to '220.127.116.11/22AS2818' route: 18.104.22.168/22 descr: BBC origin: AS2818 mnt-by: BBC-MNT source: RIPE # Filtered % Information related to '22.214.171.124/20AS2818' route: 126.96.36.199/20 descr: BBC (EU network) origin: AS2818 mnt-by: BBC-MNT source: RIPE # Filtered % Information related to '188.8.131.52/19AS2818' route: 184.108.40.206/19 descr: BBC origin: AS2818 mnt-by: BBC-MNT source: RIPE # Filtered
This indicates that their website will be available from three routes of increasing size (/19, /20 and /22 to the same prefix) via AS2818. Querying that ASN will then give us some additional information about their peers and policies (snipped for brevity):
dan.carley@jim ~ $ whois -T aut-num as2818 % This is the RIPE Database query service. % The objects are in RPSL format. % % The RIPE Database is subject to Terms and Conditions. % See http://www.ripe.net/db/support/db-terms-conditions.pdf % Note: This output has been filtered. % To receive output for a database update, use the "-B" flag. % Information related to 'AS2818' aut-num: AS2818 as-name: BBC descr: BBC Internet Services, UK import: from AS174 action pref=100; accept AS174 import: from AS286 action pref=100; accept AS-KQ AS-QWEST import: from AS553 action pref=100; accept AS-BELWUE import: from AS702 action pref=50; accept AS-UUNETUK [..] export: to AS174 announce AS-BBC export: to AS286 announce AS-BBC export: to AS553 announce AS-BBC export: to AS702 announce AS-BBC [..]
There is no static mapping between IPs and AS and an AS don't have a location.
An AS is a number assigned to a company to identify them on Internet. It's used for the BGP routing protocol.
The company tell with BGP that some network IPs (let's say network Y) are reachable inside of his AS (let's say AS X). Then others companies know that to reach network Y they must talk to AS X, with this information others company routers look for the best path to reach AS X.
Nothing prevent some networks to be advertised on many AS (and this is used in some particular case). To see a dynamic mapping of what is announced on Internet in 'real time', you can use this website. This how ATT AS information, by looking in the Prefixes IPv4 tab you will see what network they advertise. But there is no official mapping as anyone can announce anything.