The peer ip-prefix command configures the route filtering policy that is based on the IP prefix list for the peer or peer group.
The undo peer ip-prefix command cancels the route filtering policy of the peer or peer group.
By default, the peer or peer group is not specified with any route filtering policy based on the IP prefix list.
peer { group-name | ipv4-address } ip-prefix ip-prefix-name { import | export }
peer { group-name | ipv4-address | ipv6-address } ipv6-prefix ipv6-prefix-name { import | export }
undo peer { group-name | ipv4-address } ip-prefix [ ip-prefix-name ] { import | export }
undo peer { group-name | ipv4-address | ipv6-address } ipv6-prefix [ ipv6-prefix-name ] { import | export }
| 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. |
ip-prefix-name |
Specifies the name of the IP prefix list. |
The name is a string of 1 to 169 characters without spaces. It is case-sensitive. |
import |
Indicates the filtering policy that is applied to the routes imported by the specified peer or peer group. |
- |
export |
Indicates the filtering policy that is applied to the routes exported to the specified peer or peer group. |
- |
ipv6-address |
Specifies the IPv6 address of the peer. |
The prefix is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
ipv6-prefix ipv6-prefix-name |
Indicates the filtering policy that is based on the IPv6 prefix list of the peer or peer group. |
The name is a string of 1 to 169 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
BGP view, BGP-VPN instance IPv4 address family view, BGP-IPv4 unicast address family view, BGP-IPv6 unicast address family view, BGP-VPNv4 address family view, BGP-VPN instance IPv6 address family view, BGP-IPv4 multicast address family view, BGP-MDT address family view
Usage Scenario
The peer ip-prefix command can be used to configure a route filtering policy that is based on an IP prefix list to filter routes received or routes to be advertised, implementing route control.
Prerequisites
The peer as-number command has been used to create a peer or peer group.
Configuration Impact
If an IP prefix list is specified for a peer group, all the members of the peer group inherit the configuration.
After an IP prefix list is specified for a peer or peer group, the peer or peers in the peer group filter the routes to be advertised to or received from other peers based on the IP prefix list. Only the routes that pass the filtering of the IP prefix list can be advertised or received.
The IP prefix list specified for a peer or peer group can be a newly configured one. If an IP prefix list specified for a peer or peer group does not exist, you need to create an IP prefix list.
Precautions
Creating an IP prefix list before it is referenced is recommended. By default, nonexistent IP prefix lists cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent IP prefix list is referenced using the current command, all routes are advertised to the specified peer, or all routes advertised by the specified peer are accepted.
# Configure the filtering policy that is based on the IP prefix list.
<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 ip-prefix list1 import
<sysname> system-view
[sysname] bgp 100
[sysname-bgp] ipv6-family
[sysname-bgp-af-ipv6] peer group1 ipv6-prefix list1 import