Configuring the AS_PATH attribute
Permitting local AS number to appear in routes from a peer or peer group
In general, BGP checks whether the AS_PATH attribute of a route from a peer contains the local AS number. If yes, it discards the route to avoid routing loops.
In certain network environments (for example, a Hub&Spoke network in MPLS L3VPN), however, the AS_PATH attribute of a route from a peer must be allowed to contain the local AS number. Otherwise, the route cannot be advertised correctly.
To permit the local AS number to appear in routes from a peer or peer group and specify the appearance times (IPv4):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Enter BGP IPv4 unicast address family view or BGP-VPN IPv4 unicast address family view. | address-family ipv4 [ unicast ] | N/A |
4. Permit the local AS number to appear in routes from a peer or peer group and specify the appearance times. | peer { group-name | ip-address [ mask-length ] } allow-as-loop [ number ] | By default, the local AS number is not allowed in routes from a peer or peer group. |
To permit the local AS number to appear in routes from a peer or peer group and specify the appearance times (IPv6):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Enter BGP IPv6 unicast address family view or BGP-VPN IPv6 unicast address family view. | address-family ipv6 [ unicast ] | N/A |
4. Permit the local AS number to appear in routes from a peer or peer group and specify the appearance times. | peer { group-name | ipv6-address [ prefix-length ] } allow-as-loop [ number ] | By default, the local AS number is not allowed in routes from a peer or peer group. |
Disabling BGP from considering AS_PATH during optimal route selection
To disable BGP from considering AS_PATH during optimal route selection (IPv4):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Enter BGP IPv4 unicast address family view or BGP-VPN IPv4 unicast address family view. | address-family ipv4 [ unicast ] | N/A |
4. Disable BGP from considering AS_PATH during optimal route selection. | bestroute as-path-neglect | By default, BGP considers AS_PATH during optimal route selection. |
To disable BGP from considering AS_PATH during optimal route selection (IPv6):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Enter BGP IPv6 unicast address family view or BGP-VPN IPv6 unicast address family view. | address-family ipv6 [ unicast ] | N/A |
4. Disable BGP from considering AS_PATH during optimal route selection. | bestroute as-path-neglect | By default, BGP considers AS_PATH during optimal route selection. |
Advertising a fake AS number to a peer or peer group
After you move a BGP router from an AS to another AS (from AS 2 to AS 3 for example), you have to modify the AS number of the router on all its EBGP peers. To avoid such modifications, you can configure the router to advertise a fake AS number 2 to its EBGP peers so that the EBGP peers still think that Router A is in AS 2.
To advertise a fake AS number to a peer or peer group (IPv4):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Advertise a fake AS number to a peer or peer group. | peer { group-name | ip-address [ mask-length ] } fake-as as-number | By default, no fake AS number is advertised to a peer or peer group. This command applies only to EBGP peers or EBGP peer groups. |
To advertise a fake AS number to a peer or peer group (IPv6):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Advertise a fake AS number to a peer or peer group. | peer { group-name | ipv6-address [ prefix-length ] } fake-as as-number | By default, no fake AS number is advertised to a peer or peer group. This command applies only to EBGP peers or EBGP peer groups. |
Configuring AS number substitution
IMPORTANT: Do not configure AS number substitution in normal circumstances. Otherwise, routing loops might occur. | ||
To use BGP between PE and CE in MPLS L3VPN, VPN sites in different geographical areas should have different AS numbers. Otherwise, BGP discards route updates containing the local AS number. If two CEs connected to different PEs use the same AS number, you must configure AS number substitution on each PE. This substitution can replace the AS number in route updates originated by the remote CE as its own AS number before advertising them to the connected CE.
Figure 60: AS number substitution configuration (in an IPv4 network)
For example, as shown in Figure 60, CE 1 and CE 2 use the same AS number 800. To ensure bidirectional communication between the two sites, configure AS number substitution on PE 2. PE 2 replaces AS 800 with AS 100 for the BGP route update originated from CE 1 before advertising it to CE 2. Perform the same configuration on PE 1.
To configure AS number substitution for a peer or peer group (IPv4):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Configure AS number substitution for a peer or peer group. | peer { group-name | ip-address [ mask-length ] } substitute-as | By default, AS number substitution is not configured. |
To configure AS number substitution for a peer or peer group (IPv6):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Configure AS number substitution for a peer or peer group. | peer { group-name | ipv6-address [ prefix-length ] } substitute-as | By default, AS number substitution is not configured. |
Removing private AS numbers from updates sent to an EBGP peer or peer group
Private AS numbers are typically used in test networks, and should not be transmitted in public networks. The range of private AS numbers is from 64512 to 65535.
To remove private AS numbers from updates sent to an EBGP peer or peer group (IPv4):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Enter BGP IPv4 unicast address family view or BGP-VPN IPv4 unicast address family view. | address-family ipv4 [ unicast ] | N/A |
4. Configure BGP to remove private AS numbers from the AS_PATH attribute of updates sent to an EBGP peer or peer group. | peer { group-name | ip-address [ mask-length ] } public-as-only | By default, this feature is not configured. This command is only applicable to EBGP peers or peer groups. |
To remove private AS numbers from updates sent to an EBGP peer or peer group (IPv6):
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view or BGP-VPN instance view. |
| N/A |
3. Enter BGP IPv6 unicast address family view or BGP-VPN IPv6 unicast address family view. | address-family ipv6 [ unicast ] | N/A |
4. Configure BGP to remove private AS numbers from the AS_PATH attribute of updates sent to an EBGP peer or peer group. | peer { group-name | ipv6-address [ prefix-length ] } public-as-only | By default, this feature is not configured. This command is only applicable to EBGP peers or peer groups. |
Ignoring the first AS number of EBGP route updates
By default, BGP checks the first AS number of a received EBGP route update. If the first AS number is neither the AS number of the EBGP peer nor a private AS number, the BGP router disconnects the BGP session to the peer.
To ignore the first AS number of EBGP route updates:
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Enter BGP view. | bgp as-number | N/A |
3. Configure BGP to ignore the first AS number of EBGP route updates. | ignore-first-as | By default, BGP checks the first AS number of EBGP route updates. |