peer as-path-filter (BGP)

Function

The peer as-path-filter command sets the BGP route filtering policy that is based on the AS_Path for a peer or peer group.

The undo peer as-path-filter command cancels the existing configuration.

By default, the peer or peer group has no routing policy based on the AS_Path filter, and all BGP routes can pass.

Format

peer { group-name | ipv4-address | ipv6-address } as-path-filter { as-path-filter-number | as-path-filter-name } { import | export }

undo peer { group-name | ipv4-address | ipv6-address } as-path-filter { as-path-filter-number | as-path-filter-name } { import | export }

Parameters

Parameter Description Value
group-name Specifies the name of the 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 the peer. It is in dotted decimal notation.
ipv6-address Specifies the IPv6 address of the peer. The prefix is a 32-bit hexadecimal number, in the format of X:X:X:X:X:X:X:X.
as-path-filter-number Specifies the number of the AS_Path filter. The value is an integer ranging from 1 to 256.
as-path-filter-name Specifies the name of the AS_Path filter. The name is a string of 1 to 51 characters without any space. It is case-sensitive.
NOTE:
When double quotation marks are used around the string, spaces are allowed in the string.
import Filters the received routes. -
export Filters the advertised routes. -
NOTE:
  • ipv4-address is valid only in the BGP view, BGP-IPv4 unicast address family view, BGP-IPv6 unicast address family view, BGP-VPNv4 address family view, BGP-VPN6 address family view, BGP-VPN-Target 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.

Views

BGP view, BGP-IPv4 unicast address family view, BGP-VPN instance IPv4 address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv6 address family view, BGP-VPNv4 address family view, BGP-VPNv6 address family view, BGP-VPN-Target address family view

Only the AntiDDoS8000 series support BGP-VPNv6 address family view.

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

After the peer as-path-filter command is used to apply a route filtering policy based on an AS_Path list to BGP routes, the routers that do not match the policy are filtered out.

Prerequisites

The ip as-path-filter command has been run to define an AS_Path filter.

Configuration Impact

Only one AS_Path filter can be used to filter the routes received from the same peer. Similarly, only one AS_Path filter can be used to filter routes to be advertised to the same peer.

Precautions

To configure IPv6 provider edge (6PE), specify the address of the peer as an IPv4 unicast address in the IPv6 unicast address family view.

Creating an AS_Path filter before it is referenced is recommended. By default, nonexistent AS_Path filters cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent AS_Path filter is referenced using the current command, all routes are advertised to the specified peer, or all routes advertised by the specified peer are accepted.

Example

# Set the AS_Path filter for a peer or a peer group.

<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 as-path-filter 3 export

Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.