Skip to Content

What is an ASN in BGP?- All you need to know about AS numbers

What is an ASN in BGP?- All you need to know about AS numbers

We all have configured Routing protocols and heard about the term ASN/AS numbers (Autonomous system number). However, when it comes to BGP, have you ever wondered what ASN really is and how you can get one?
In this blog, let’s answer what ASN is in the BGP routing protocol, and it’s differences and types.

A BGP public ASN or AS number is a unique number given to an AS (Autonomous System). The AS is a group of gateways or routers that has unique routing policy under a single administration, ASN is available worldwide to route IP prefixes from one AS to Neighbouring AS under BGP. Routers under a single AS would be under an organization entity managed by one or more network engineers.

what is ASN
Example of how ASN’s are interconnected.

Each ASN on the internet has its public IP prefixes or IP addresses associated with it.
Just like how you can find who owns specific public IPs by searching on google, you can do the same thing for ASN as well. If you search ‘AT&T ASN’ you would be able to see its public ASN number, so do ‘google ASN,’ and ‘Microsoft ASN.’ and so on.
I hope now you get the idea of what an AS number is.

Now the question is,

Do you need ASN for your organization?

The answer mostly would be ‘NO‘ unless you are using two ISPs for multihoming to route traffic and has a unique routing policy.

What if you own a unique public ASN for your organization?
You can add them to BGP and do a lot of BGP route policies using both ISP links.
One ISP can use as primary and the other one as secondary, you can also do unequal load balancing using both links as well.

When it comes to BGP autonomous system number, it’s very large similar to IP addresses.

BGP ASN 16bits (2bytes) vs 32bits (4bytes)

Initially, when BGP introduced, it had AS numbers starting from 0-65535, and it was 16bits (2 bytes) space. This was enough back then when the internet was small, but when the routing table grew it had to increase from 16bits to 32bits (4 bytes), which gave us the ASN from 65536 to 4,294,967,295. wow! That is more than enough on the modern internet.

Different types of AS numbers

However, not all the BGP ASN are considered equal, There are different types of ASN’s. Let’s take a look at that.

On the 16bit AS numbers, 0 and 65535 reserved and it cannot use on the network.
Remember I spoke about public ASN, Among the AS numbers, 1- 64495 are used on the public internet.
64496-64511 and 65536-65511 are for the documentation purpose which is RFC5398

On the 32bit ASN space, 65552-4199999999 are for public internet, and ASN 4200000000-4294967295 are for private use only.

Just like private IP addresses, there are private ASN as well, which are starting from 64512-65534, and it can only use on private networks. For instance, if you have a large Enterprise and the routing table is so big, and you wanted scale-out, you could use BGP internally with private as numbers. But before you connect to the internet, make sure you are not peering private ASN with the internet, which is public ASN space.

How to remove private ASN in a router ?

In Cisco, you can run the below command for not to advertise BGP private ASN to the internet.

neighbor x.x.x.x remove-private-as

As I mentioned before, the internet is the place for public ASN, and each ASN must be unique.

The above command force BGP to drop private ASN. The ISP’s do not allow you to send private ASN to their network space.

How to get BGP AS number

By this point you are very clear about the private AS numbers, right ?
let’s focus now on public AS number and how you can get an ASN number for your organisation or an enterprise.

All the ASN numbers and the IP addresses are used to managed by a centralized authority called IANA, known as Internet Assigned Numbers Authority. Later they decentralized to RIR – Regional internet registry based on regions.
Now RIR takes care of the allocation and registration of public IP address space as well as the AS number’s, of course based on the regional policy inline with IANA.

What is RIR

Regional Internet Registry (RIR) is a nonprofit organization that takes care of the allocation and registration of public IP addresses and AS numbers to its customers. Those customers would be LIR ( local Internet registry) which is an ISP, NIR (National Internet Registry) or end-user organization that requires public routable address space.

RIR is location-specific, below are the list of RIR and link to submit the ASN.

List of RIRLocation it servesLink to request ASN
AFRINIC (The African Network Information Center)AFRIChttps://www.afrinic.net/our-factsheets/204-asn-request-template
ARIN (The American Registry for Internet Numbers)Antarctica, Canada, parts of the Caribbean, and the United Stateshttps://www.arin.net/resources/guide/request/
APNIC (The Asia-Pacific Network Information Centre)East Asia, Oceania, South Asia, and Southeast Asia
https://www.apnic.net/get-ip/get-ip-addresses-asn/
LACNIC (The Latin America and Caribbean Network Information Centre)Most of the Caribbean and all of Latin Americahttps://www.lacnic.net/1016/2/lacnic/ip-request
RIPE NCC (The Réseaux IP Européens Network Coordination Centre )Europe, Central Asia, Russia, and West Asiahttps://www.ripe.net/manage-ips-and-asns/as-numbers/request-an-as-number