Overview

Use the neighbor remove-private-AS command to remove private AS number from the AS_PATH of BGP route. This section describes the neighbor remove-private-AS command.

neighbor remove-private-AS command

AS numbers in the AS_PATH attribute can be prepend, but basically cannot be deleted. As an exception, private AS number of BGP route to be advertised to the EBGP neighbor can be removed from AS_PATH attribute. Usually, to prevent private AS numbers from being passed around on the Internet.

To remove the private AS number from the AS_PATH attribute, configure the following

neighbor remove-private-AS

(config)#router bgp <AS>
(config-router)#neighbor <ip-address> remove-private-AS

<AS>:AS number
<ip-address>: Neighbor IP address

This command removes the private AS number from the AS_PATH attribute of BGP routes sent to the specified neighbor. The neighbor remove-private-AS command has the following conditions

  • For EBGP neighbors only
  • It does not work when the AS_PATH attribute contains both global and private AS numbers.
  • In confederation environments, the AS_PATH attribute is deleted if the portion after the { } contains private AS number.
  • If the AS_PATH attribute contains the AS number of the specified neighbor, the private AS number is not deleted.

neighbor remove-private-AS command example

Configure the neighbor remove-private-AS command with the following network diagram.

Figure neighbor remove-private-AS configuration example
Figure neighbor remove-private-AS configuration example

The BGP configuration for R1/R3/ISP1 is as follows

R1 BGP Configuration

router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 65003
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 172.16.1.11 remote-as 1
 no auto-summary

R3 BGP Configuration

router bgp 65003
 no synchronization
 bgp log-neighbor-changes
 network 100.100.1.0 mask 255.255.255.0
 network 100.100.2.0 mask 255.255.255.0
 network 100.100.3.0 mask 255.255.255.0
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 ebgp-multihop 255
 neighbor 1.1.1.1 update-source Loopback0
 no auto-summary

ISP1 BGP Configuration

router bgp 1
 bgp log-neighbor-changes
 network 100.1.1.0 mask 255.255.255.0
 network 100.1.2.0 mask 255.255.255.0
 network 100.1.3.0 mask 255.255.255.0
 neighbor 172.16.1.1 remote-as 100
 no auto-summary

The route received from R1 on ISP1 contains R3’s private AS number 65003 in the AS_PATH attribute.

ISP1 BGP Table

ISP1#show ip bgp
BGP table version is 27, local router ID is 111.1.1.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.1.1.0/24     0.0.0.0                  0         32768 i
*> 100.1.2.0/24     0.0.0.0                  0         32768 i
*> 100.1.3.0/24     0.0.0.0                  0         32768 i
*> 100.100.1.0/24   172.16.1.1                             0 100 65003 i
*> 100.100.2.0/24   172.16.1.1                             0 100 65003 i
*> 100.100.3.0/24   172.16.1.1                             0 100 65003 i

From this state, configure neighbor remove-private-AS on R1 to remove the private AS number from the AS_PATH attribute of routes sent to ISP1.

R1 remove-private-AS configuration

router bgp 100
 neighbor 172.16.1.11 remove-private-AS

Again viewing the BGP table on ISP1, the private AS number 65003 has been removed from the AS_PATH attribute of the route received from R1.

ISP1 BGP Table(after configuring remove-private-AS)

ISP1#show ip bgp
BGP table version is 30, local router ID is 111.1.1.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 100.1.1.0/24     0.0.0.0                  0         32768 i
*> 100.1.2.0/24     0.0.0.0                  0         32768 i
*> 100.1.3.0/24     0.0.0.0                  0         32768 i
*> 100.100.1.0/24   172.16.1.1                             0 100 i
*> 100.100.2.0/24   172.16.1.1                             0 100 i
*> 100.100.3.0/24   172.16.1.1                             0 100 i
Figure remove-private-AS behavior
Figure remove-private-AS behavior

Summary

Points

  • The neighbor remove-private-AS command allows to remove the private AS number from the AS_PATH of the BGP route.
  • The neighbor remove-private-AS command format is as follows
    • (config)#router bgp <AS>
      (config-router)#neighbor <ip-address> remove-private-AS