The peer public-as-only command configures an MBGP device to remove all private AS numbers from the AS_Path attribute in an MBGP Update packet to be sent.
The undo peer public-as-only command cancels the configuration.
By default, the AS-Path in an MBGP Update packet is allowed to carry private AS numbers.
peer peerIpv4Addr public-as-only
peer peerIpv4Addr public-as-only force [ replace ] [ include-peer-as ]
peer peerIpv4Addr public-as-only limited [ replace ] [ include-peer-as ]
undo peer peerIpv4Addr public-as-only
undo peer peerIpv4Addr public-as-only force [ replace ] [ include-peer-as ]
undo peer peerIpv4Addr public-as-only limited [ replace ] [ include-peer-as ]
Parameter | Description | Value |
---|---|---|
peerIpv4Addr |
Specifies the IP address of an MBGP peer. |
The address is in dotted decimal notation. |
force |
Deletes all private AS numbers from the AS_Path attribute except the private AS number of a specified peer or peer group. |
- |
replace |
Replaces the private AS numbers in the AS_Path attribute with the local AS number except the private AS number of a specified peer or peer group. |
- |
include-peer-as |
Deletes all private AS numbers from the AS_Path attribute. |
- |
limited |
Deletes private AS numbers from the leftmost one to the local or a public AS number except the private AS number of a specified peer or peer group. |
- |
Usage Scenario
Generally, AS numbers range from 1 to 4294967295, including the public, private, and reserved AS numbers. If the private-4-byte-as enable command is not run, private AS numbers range from 64512 to 65534, and the AS number 65535 is reserved for special use. If the private-4-byte-as enable command is run, private AS numbers range from 64512 to 65534 and from 4200000000 to 4294967294, and the AS numbers 65535 and 4294967295 are reserved for special use.
Public AS numbers can be used over the Internet, whereas private AS numbers cannot be advertised to the Internet. If private AS numbers are advertised to the Internet, routing loops may occur. Therefore, private AS numbers are used only within a routing domain. This command enables BGP to process the private and reserved AS numbers in the AS_Path attribute of BGP routes as required. Reserved AS numbers are processed the same as private AS numbers. The following uses private AS numbers as an example to illustrate the processing modes: If the peer public-as-only command is run without any optional parameter specified and the AS_Path attribute of BGP routes contains only private AS numbers, BGP deletes these private AS numbers before advertising the routes. BGP does not delete private AS numbers in either of the following scenarios if the peer public-as-only command is run, without any parameter following public-as-only specified: • The AS_Path attribute of a route carries the AS number of the remote peer. In this case, deleting private AS numbers may lead to a routing loop. • The AS_Path attribute carries both public and private AS numbers, which indicates that the route has passed through the public network. In this case, deleting private AS numbers may lead to a traffic forwarding error. Parameters that are used to delete or replace private AS numbers are described as follows: • force: deletes all private AS numbers from the AS_Path attribute except the private AS number of a specified peer group. • force replace: replaces the private AS numbers in the AS_Path attribute with the local AS number except the private AS number of a specified peer group. • force include-peer-as: deletes all private AS numbers from the AS_Path attribute. • force replace include-peer-as: replaces the private AS numbers in the AS_Path attribute with the local AS number. This parameter ensures that the AS_Path attribute length remains unchanged. Therefore, the route selection result is not affected. • limited: deletes private AS numbers from the leftmost one to the local or a public AS number except the private AS number of a specified peer group. • limited replace: replaces private AS numbers from the leftmost one to the local or a public AS number in the AS_Path attribute with the local AS number except the private AS number of a specified peer group. • limited include-peer-as: deletes private AS numbers from the leftmost one to the local or a public AS number. This parameter ensures that all private AS numbers of the local network are deleted. • limited replace include-peer-as: replaces private AS numbers from the leftmost one to the local or a public AS number in the AS_Path attribute with the local AS number. Select one of the preceding parameters based on the network topology to prevent routing loops or forwarding errors.Precautions
Select one of the preceding parameters based on the network topology to prevent routing loops or forwarding errors.
<HUAWEI> system-view [~HUAWEI] bgp 100 [*HUAWEI-bgp] peer 1.1.1.1 as-number 100 [*HUAWEI-bgp] ipv4-family multicast [*HUAWEI-bgp-af-multicast] peer 1.1.1.1 enable [*HUAWEI-bgp-af-multicast] peer 1.1.1.1 public-as-only