peer filter-policy
Function
The peer filter-policy command configures a filtering policy to advertise or receive routes from peers or peer group.
The undo peer filter-policy command deletes the filtering policy used to advertise or receive routes from peers or peer group.
By default, no filtering policy is configured to advertise or receive routes from peers or peer group.
Format
peer { group-name | ipv4-address | ipv6-address } filter-policy { acl-number | acl-name acl-name | acl6-number | acl6-name acl6-name } { import | export }
undo peer { group-name | ipv4-address | ipv6-address } filter-policy { acl-number | acl-name acl-name | acl6-number | acl6-name acl6-name } { import | export }
Parameters
Parameter | Description | Value |
---|---|---|
group-name | Specifies the name of a peer group. | The name is a string of 1 to 47 characters without any space. It is case-sensitive. |
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 prefix is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
acl-number | Specifies the number of a basic ACL. | The value is an integer ranging from 2000 to 2999. |
acl-name acl-name | Specifies the name of an ACL. | The value is a string of 1 to 32 case-sensitive characters without spaces. The name should start with a letter and can contain numbers, hyphens (-), or underlines (_). |
acl6-number | Specifies the number of a basic IPv6 ACL. | The value is an integer ranging from 2000 to 2999. |
acl6-name acl6-name | Specifies the name of an IPv6 ACL. | The value is a string of 1 to 32 case-sensitive characters without spaces. The name should start with a letter and can contain numbers, hyphens (-), or underlines (_). |
import | Filters received routes. | - |
export | Filters routes to be advertised. | - |
ipv4-address, acl-name acl-name, and acl-number are valid only in the BGP view, BGP-IPv4 unicast address family view.
ipv6-address, acl6-name acl6-name, and acl6-number are valid only in the BGP-IPv6 unicast address family view.
Views
BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, BGP-IPv6 unicast address family view
Usage Guidelines
Usage Scenario
The peer filter-policy command is used to configure an ACL-based policy for filtering routes received from peers or routes to be advertised to peers.
A proper basic ACL needs to be selected based on the address family of a peer or peer group.
Prerequisites
Peer relationships have been established using the peer as-number command.
A basic ACL needs to be configured.
Precautions
If the peer filter-policy command is run multiple times, the latest configuration overwrites the previous one. For example, if the peer 1.1.1.2 filter-policy 2600 import command is run and then the peer 1.1.1.2 filter-policy 2400 import command is run, the configuration of the peer 1.1.1.2 filter-policy 2400 import command overwrites that of the peer 1.1.1.2 filter-policy 2600 import command.
When the rule command is run to configure rules for an ACL, only the source address range specified by source and the time period specified by time-range take effect.
Example
# Set the IPv4 filtering policy for peers.
<AC6605> system-view
[AC6605] acl 2000
[AC6605-acl-basic-2000] rule permit
[AC6605-acl-basic-2000] quit
[AC6605] bgp 100
[AC6605-bgp] peer 1.1.1.2 as-number 200
[AC6605-bgp] ipv4-family unicast
[AC6605-bgp-af-ipv4] peer 1.1.1.2 filter-policy 2000 import
<AC6605> system-view
[AC6605] acl ipv6 2001
[AC6605 -acl6-basic-2001] rule permit
[AC6605 -acl6-basic-2001] quit
[AC6605] bgp 100
[AC6605-bgp] peer 1:2::3:4 as-number 200
[AC6605-bgp] ipv6-family unicast
[AC6605-bgp-af-ipv6] peer 1:2::3:4 filter-policy 2000 import