The peer public-as-only command configures the AS-Path attribute in a BGP Update packet not to carry the private AS number. Only the public AS number is contained in the update packets.
The undo peer public-as-only command restores the default setting.
By default, the AS-Path attribute in a BGP Update packet is allowed to carry private AS numbers.
peer { group-name | ipv4-address | ipv6-address } public-as-only [ force ]
undo peer { group-name | ipv4-address | ipv6-address } public-as-only
Parameter | Description | Value |
---|---|---|
group-name | Specifies the name of a peer group. | The name is a string of 1 to 47 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
ipv4-address | Specifies the IPv4 address of a peer. | It is in dotted decimal notation. |
ipv6-address | Specifies the IPv6 address of a peer. | The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
force | In the following two cases, BGP does not delete the private AS number after the command is used:
To enable the device to delete the private AS numbers from the AS_Path attribute before sending update packets even in the preceding scenarios, specify force in the command. |
- |
ipv4-address is valid only in the BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, BGP-VPN instance IPv4 address family view, BGP-VPNv4 address family view, BGP L2VPN-AD address family view, BGP-IPv6 unicast address family view, and BGP-VPNv6 address family view.
ipv6-address is valid only in the BGP-IPv6 unicast address family view and BGP-VPN instance IPv6 address family view.
BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, BGP-VPN instance IPv4 address family view, BGP-VPNv4 address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv6 address family view, BGP-VPNv6 address family view, BGP L2VPN-AD address family view
Usage Scenario
In general, an AS number ranges from 1 to 4294967295. The public AS number ranges from 1 to 64511, and 65536 (1.0 in the format of x.y) to 4294967295 (65535.65535 in the format of x.y), and the private AS number ranges from 64512 to 65534. 65535 is used as the reserved AS number in certain circumstances.
Public AS numbers can be used on the Internet. Private AS numbers cannot be advertised to the Internet, and they are used only within ASs. If private AS numbers are advertised to the Internet, a routing loop may occur. After this command is configured, if the AS path attribute contains only private AS numbers, BGP deletes the private AS numbers and then advertises these update routes.
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.
Prerequisites
Peer relationships have been established using the peer as-number command.