The peer public-as-only command configures a device to delete private AS numbers (if any) from the AS_Path attribute before sending update packets.
The undo peer public-as-only command configures BGP to send BGP update packets with private AS numbers.
By default, private AS numbers can be contained in the BGP update packets to be advertised.
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. |
The value is in dotted decimal notation. |
ipv6-address |
Specifies the IPv6 address of a peer. |
The address is a 32-digit hexadecimal number in the X:X:X:X:X:X:X:X format. |
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-VPN-Target family view, BGP-IPv6 unicast address family view, BGP-VPNv4 address family view, and BGP-VPN instance IPv4 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-VPN instance IPv4 address family view, BGP-VPN instance IPv6 address family view, BGP-VPNv4 address family view, BGP-IPv6 unicast address family view, BGP-VPN-Target family view
Usage Scenario
In general, the number of an AS 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.
Prerequisites
A peer or peer group has been configured using the peer as-number command.
Configuration Impact
If the peer public-as-only command is run for a peer group, the peers of the peer group inherit the configuration.
Precautions
The command is applicable only to EBGP peers.
# Configure BGP to send update packets without private AS numbers to the peer.
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] peer 1.1.1.2 as-number 200
[sysname-bgp] ipv4-family unicast
[sysname-bgp-af-ipv4] peer 1.1.1.2 public-as-only
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] group test external
[sysname-bgp] ipv6-family
[sysname-bgp-af-ipv6] peer test enable
[sysname-bgp-af-ipv6] peer test public-as-only