< Home

peer public-as-only

Function

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.

Format

peer { group-name | ipv4-address | ipv6-address } public-as-only [ force ]

undo peer { group-name | ipv4-address | ipv6-address } public-as-only

Parameters

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:

  • The AS_Path of a route contains the AS number of the peer. In this case, deleting the private AS numbers may lead to a routing loop.

  • The AS_Path list contains both public network AS numbers and private AS numbers, indicating that the route has passed through the public network. Deleting the private AS numbers may lead to a forwarding error.

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.

Views

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

Default Level

2: Configuration level

Usage Guidelines

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.

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.

Prerequisites

Peer relationships have been established using the peer as-number command.

Example

# Configure a device to remove all private AS numbers from the AS_Path attribute when sending a BGP Update packet to its peer.

<HUAWEI> system-view
[HUAWEI] bgp 100
[HUAWEI-bgp] peer 10.1.1.2 as-number 200
[HUAWEI-bgp] ipv4-family unicast
[HUAWEI-bgp-af-ipv4] peer 10.1.1.2 public-as-only
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >