BGP Attribute: Removing Private AS Numbers from the AS Path

Today I am going to talk about the configuration scenarios of BGP- Border Gateway Routing Protocol. In our scenario we will configure removing Private AS number from the AS Path in BGP. 

What is Private and Public AS numbers?
Public AS numbers are allocated by InterNIC and are worldwide unique. They range from 1 to 64511. Private AS numbers are used to conserve globally unique and they range from 64512 to 65535. 

Public AS number Range: 1 to 64511
Private AS number Range: 64512 to 65535

Private AS numbers are used by service providers like AT&T, Verizon, TATA or some of the customers to preserve globally unique AS numbers. Private AS numbers cannot be used to access the global Internet because they are not unique. AS numbers appear in eBGP AS paths in routing updates. Eliminating private ASNs from the AS path is essential if you have been operating private ASNs and you need to access the global Internet.

Private AS numbers cannot be disclosed to a global BGP routing table because they are not unique, and BGP best path calculations need unique AS numbers. Consequently, it might be essential to remove private AS numbers from an AS path before the routes are transmitted to a BGP peer.

What are the benefits to remote the Private AS numbers from the AS Path BGP Attribute?
I knew many of you have this question and many of you already knew about it. External BGP or so called eBGP involves that globally unique AS numbers be used when routing to the global Internet. Using private AS numbers would prevent access to the global Internet. 

This feature permits routers that fit to a private AS to access the global Internet. A network supervisor designs the routers to remove private AS numbers from the AS path contained in outbound update messages and optionally, to interchange those numbers with the ASN of the local router, so that the AS Path length remains unchanged.

Fig 1.1- Removing Private AS numbers in BGP 
Let’s take an example as shown in the above diagram where we have RouteXP_R2# router, belonging to the Service Provider, removes private AS numbers as follows.
  • RouteXP_R3# router advertises the network 10.0.0.0/24 with the AS path attribute 64500 to RouteXP_R2# router. 
  • RouteXP_R2# router receives the update from RouteXP_R3# router and makes an entry for the network 10.0.0.0/24 in its routing table with the next hop as 192.168.0.1 via WAN interface.
  • RouteXP_R2# router (service provider device), when configured with the neighbor 192.168.1.2 remove-private-as command, strips off the private AS number and constructs a new update packet with its own AS number as the AS path attribute for the 10.10.0.0/24 network and sends the packet to RouteXP_R1# router. 
  • RouteXP_R1# router receives the eBGP update for network 10.10.0.0/24 and makes an entry in its routing table with the next hop as 192.168.1.1. The AS path attribute for this network as seen on RouteXP_R1# router is AS 100 (RouteXP_R2# router). Thus, the private AS numbers are prevented from entering the BGP tables of the Internet.

Configuration on RouteXP_R3# 
!
interface gigabitethernet 0/1
 ip address 10.10.0.1 255.255.255.0
!
interface Serial 0
 ip address 192.168.0.1 255.255.255.0
!
router bgp 64500
 network 10.10.0.0 mask 255.255.255.0
 neighbor 192.168.0.2 remote-as 100
!---Configures RouteXP_R2 as an eBGP neighbor in public AS 100.
!

Configuration on RouteXP_R2# 
!
interface gigabitethernet 0/1
 ip address 10.20.1.1 255.255.255.0
!
interface Serial 0
 ip address 192.168.0.2 255.255.255.0
!
interface Serial 1
 ip address 192.168.1.1 255.255.255.0
!
router bgp 100
 network 10.20.0.0
 network 192.168.0.0
 neighbor 192.168.0.1 remote-as 64500
!---Configures RouteXP_R3 as an eBGP neighbor in private AS 64500.
 neighbor 192.168.1.2 remote-as 200
!---Configures RouteXP_R1 as an eBGP neighbor in public AS 200.
 neighbor 192.168.1.2 remove-private-as
!---Removes the private AS numbers from outgoing eBGP updates.
!

Configuration on RouteXP_R1# 
!
interface Serial 0
 ip address 192.168.1.2 255.255.255.0
!
router bgp 1
 neighbor 192.168.1.1 remote-as 100
!---Configures RouteXP_R2 as an eBGP neighbor in public AS 100.
!