The peer public-as-only command configures the AS-Path attribute in a BGP Update message not to carry the private AS number. Only the public AS number is contained in the update messages.
The undo peer public-as-only command allows the AS-Path attribute in a BGP Update message to carry the private AS number.
By default, the AS-Path attribute in a BGP Update message is allowed to carry private AS numbers.
peer ipv4-address public-as-only
peer ipv4-address public-as-only force [ replace ] [ include-peer-as ]
peer ipv4-address public-as-only limited [ replace ] [ include-peer-as ]
undo peer ipv4-address public-as-only
undo peer ipv4-address public-as-only force [ replace ] [ include-peer-as ]
undo peer ipv4-address public-as-only limited [ replace ] [ include-peer-as ]
Parameter | Description | Value |
---|---|---|
ipv4-address |
Specifies the IPv4 address of a peer. |
It 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. |
- |
replace |
Replaces private AS numbers in an AS_Path list with a local AS number: If both force and replace are specified, private AS numbers in an AS_Path list, except the AS number of a specified peer or peer group, are replaced with the local AS number. If both limited and replace are specified, private AS numbers starting from the leftmost one in an AS_Path list, except the local or private AS number of a specified peer or peer group, are replaced with the local AS number. |
- |
include-peer-as |
Deletes AS numbers: If both force and include-peer-as are specified, all private AS numbers are forcibly deleted. If force, replace, and include-peer-as are specified, the private AS numbers in an AS_Path list are replaced with the local AS number. If both limited and include-peer-as are specified, the AS numbers starting from the leftmost one in an AS_Path list, except the local and public AS numbers, are deleted. If limited, replace, and include-peer-as are specified, private AS numbers starting from the leftmost one in an AS_Path list, except the local or private AS numbers, are replaced with the local AS number. |
- |
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. |
- |
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.Configuration Impact
If the peer public-as-only command is run for a peer group, the peers of the peer group inherit the configuration.