peer public-as-only
Use peer public-as-only to remove private AS numbers in BGP updates sent to an EBGP peer or peer group.
Use undo peer public-as-only to remove the configuration.
Syntax
In BGP IPv4 unicast address family view/BGP-VPN IPv4 unicast address family view/BGP IPv4 multicast address family view:
peer { group-name | ipv4-address [ mask-length ] } public-as-only
undo peer { group-name | ipv4-address [ mask-length ] } public-as-only
In BGP IPv6 unicast address family view:
peer { group-name | ipv6-address [ prefix-length ] } public-as-only
undo peer { group-name | ipv6-address [ prefix-length ] } public-as-only
In BGP-VPN IPv6 unicast address family view/BGP IPv6 multicast address family view:
peer { group-name | ipv6-address [ prefix-length ] } public-as-only
undo peer { group-name | ipv6-address [ prefix-length ] } public-as-only
Default
BGP updates sent to an EBGP peer or peer group can carry both public and private AS numbers.
Views
BGP IPv4 unicast address family view
BGP-VPN IPv4 unicast address family view
BGP IPv6 unicast address family view
BGP-VPN IPv6 unicast address family view
BGP IPv4 multicast address family view
BGP IPv6 multicast address family view
Predefined user roles
network-admin
Parameters
group-name: Specifies a peer group by its name, a case-sensitive string of 1 to 47 characters. The peer group must have been created.
ipv4-address: Specifies a peer by its IPv4 address. The peer must have been created.
mask-length: Specifies a mask length in the range of 0 to 32. You can use the ipv4-address and mask-length arguments together to specify a subnet. If you specify a subnet, this command removes private AS numbers in BGP updates sent to all dynamic peers in the subnet.
ipv6-address: Specifies a peer by its IPv6 address. The peer must have been created.
prefix-length: Specifies a prefix length in the range of 0 to 128. You can use the ipv6-address and prefix-length arguments together to specify a subnet. If you specify a subnet, this command removes private AS numbers in BGP updates sent to all dynamic peers in the subnet.
Usage guidelines
Private AS numbers are typically used in test networks, and need not be transmitted in public networks. The range of private AS numbers is from 64512 to 65535.
After you execute the command, you can get the following results:
If the AS_PATH attribute of a BGP update carries only private AS numbers, the device removes the AS numbers before sending the update to the EBGP peer or peer group.
If the AS_PATH attribute carries both public and private AS numbers, the command does not take effect. The device sends the BGP update to the EBGP peer or peer group without removing the private AS numbers.
If the AS_PATH attribute carries AS numbers of the peer or peer group, the command does not take effect. The device sends the BGP update to the peer or peer group without removing the private AS numbers.
This command is applicable only to EBGP peers and peer groups.
Examples
# In BGP IPv4 unicast address family view, remove private AS numbers in BGP updates sent to EBGP peer group test.
<Sysname> system-view [Sysname] bgp 100 [Sysname-bgp-default] address-family ipv4 unicast [Sysname-bgp-default-ipv4] peer test public-as-only