The peer as-path-filter command configures a BGP route filtering policy based on an AS_Path list for a peer or peer group.
The undo peer as-path-filter command cancels the existing configuration.
By default, no route filtering policy based on an AS_Path list is configured for a peer or peer group.
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 }
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. |
as-path-filter-number |
Specifies the number of an AS_Path filter. |
The value is an integer that ranges from 1 to 256. |
as-path-filter-name |
Specifies the name of an AS_Path filter. |
The name is a string of 1 to 51 case-sensitive characters. It cannot be all numbers. When double quotation marks are used around the string, spaces are allowed in the string. |
import |
Applies a route filtering policy to received routes. |
- |
export |
Applies a route filtering policy to routes to be advertised. |
- |
ipv4-address is valid only in the BGP view, BPG-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, 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.
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
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 routes that do not match the policy are filtered out.
Prerequisites
Peer relationships have been established using the peer as-number command.
The ip as-path-filter command has been run to define an AS-Path filter.
Precautions
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.
Creating an AS_Path filter before it is referenced is recommended. By default, the command in an IPv4 address family cannot reference a non-existent AS_Path filter, but the command in an IPv6 address family can reference a non-existent AS_Path filter. 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.