peer public-as-only force (BGP-VPN-Target address family view)

Function

The peer public-as-only force command configures the AS-Path attribute in a BGP Update message to delete all private AS numbers from the AS_Path attribute except the private AS number of a specified peer.

The undo peer public-as-only force command restores the default setting.

By default, the AS-Path attribute in a BGP Update message is allowed to carry private AS numbers.

Format

peer ipv4-address public-as-only force [ replace ] [ include-peer-as ]

undo peer ipv4-address public-as-only force [ replace ] [ include-peer-as ]

Parameters

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.

-

Views

BGP-VPN-target address family view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
bgp write

Usage Guidelines

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.

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.

Example

# Enable a device to delete all private AS numbers from the AS_Path attribute except the private AS number of a specified peer when the device sends BGP Update messages to the peer.
<HUAWEI> system-view
[~HUAWEI] bgp 100
[*HUAWEI-bgp] peer 10.2.2.2 as-number 200
[*HUAWEI-bgp] ipv4-family vpn-target
[*HUAWEI-bgp-af-vpn-target] peer 10.2.2.2 enable
[*HUAWEI-bgp-af-vpn-target] peer 10.2.2.2 public-as-only force
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >