BGP Private and Public AS Range
Just like IP addresses, ASNs (Autonomous System Numbers) have to be unique on the Internet. The main reason for this is that BGP uses the AS number for its loop prevention mechanism. When BGP learns about a route that has its own AS number in its path then it will be discarded.
Here’s an example:
Above we have three routers, R1 and R3 are using the same AS number. Once R1 sends an update, R2 will accept it but R3 will not since the AS number is the same.
To prevent the above from happening, IANA is in control of the AS numbers (similar to public IP addresses). If you want an AS number for the Internet then you’ll have to request one. They started with 16-bit AS numbers (also called 2-octet AS numbers) that were assigned like this:
- 0: reserved.
- 1-64.495: public AS numbers.
- 64.496 – 64.511 – reserved to use in documentation.
- 64.512 – 65.534 – private AS numbers.
- 65.535 – reserved.
The 1-64.495 public AS range is pretty small so there are similar issues to the IPv4 public IP addresses, there aren’t enough numbers. Right now (May 2015) there are only 199 AS numbers left that could be assigned. You can see the current status of available AS numbers here.
To get more AS numbers, an extension has been created that supports 32-bit AS numbers (also called 4-octet AS numbers). This means we have about 4.294.967.296 AS numbers that we can use.
When you request an AS number you’ll have to justify why you need a public AS number. For some organizations, using a private AS number should also be a solution.
Private AS numbers can be used when you are connected to a single AS that uses a public AS number. Here’s an example:
R1 is behind R2 and using private AS number 64512. R2 is using public AS number AS 2. In the BGP table of R2 we will find the AS number of R1 but once it advertises something to AS3, it will remove the private AS number.
Another example where we can use private AS numbers are BGP confederations. Within the confederation we can use private AS numbers, to the outside world we use a public AS number.
Removing the private AS numbers is a bit similar to NAT where we hide private IP addresses behind one or more public IP addresses.
Hopefully this lesson has been helpful to understand the difference between public and private AS numbers. IF you have any questions, feel free to leave a comment.
Unit 1: Introduction to BGP
- Introduction to BGP
- Single/Dual (multi) homed connections
- eBGP (external BGP)
- eBGP Multi-Hop
- iBGP (internal BGP)
- How to read the BGP Table
- How to advertise networks in BGP
- iBGP Next Hop Self
- BGP Auto-summary
Unit 2: BGP Neighbor Adjacency
- BGP Neighbor Adjacency States
- BGP Messages
- Troubleshooting BGP Neighbor Adjacency
- Troubleshooting BGP Route Advertisement
Unit 3: BGP Attributes
- BGP Attributes and Path Selection
- BGP Weight Attribute
- BGP Local Preference
- BGP AS Path Prepending
- BGP Origin Code
- BGP MED (metric) Attribute
Unit 4: BGP Communities
Unit 5: BGP Filtering
- BGP Regular Expressions
- BGP Transit AS
- BGP IPv6 route filtering
- BGP AS Path Filter
- BGP Extended Access-List Filtering
Unit 6: Advanced BGP Features
- BGP Peer Groups
- BGP Route Reflector
- BGP Confederations
- BGP Synchronization
- BGP Backdoor Routes
- MP-BGP (multi-protocol BGP)
- BGP Private and Public AS Numbers
- BGP Remove Private AS Numbers
- BGP 4-byte AS numbers
- BGP Soft Reconfiguration
- BGP Route Refresh Capability
- BGP Allow AS in
- BGP AS Override
- BGP Aggregate AS-SET
- BGP Multipath eBGP and iBGP