Configure Prefix List
Configuration Condition
None
Configure a Prefix List
The prefix list filters routes based on prefixes. The ACL is first designed to filter data packets and then used to filter routes while the prefix list is designed to filter routes. Through some route filtering functions of the ACL and prefix list are the same, the prefix list is more flexible than the ACL.
A prefix list is identified by a prefix list name. Each prefix list contains multiple entries, and each entry can specify a matching range independently. Each entry has a serial number, indicating the sequence in which the prefix list implements matching checks.
The entries of a prefix list are in the OR relation. When a route tries to match a prefix list, it checks the entries in the sequence of small to large. Once the route matches an entry, it passes the filtration of the prefix list, and the next entry will no longer be checked.
Table 15-2 Configure a prefix list
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Configure an IPv4 prefix list.
|
ip prefix-list prefix-list-name [ seq seq-value ] { deny | permit } network / length [ ge ge-value ] [ le le-value ]
|
Mandatory.
By default, no IPv4 prefix list is configured.
|
-
The value range is 0<=length<ge-value<=le-value<=32, where "ge" means equal to or larger than, and "le" means equal to or smaller than. If ip prefix-list test permit 192.168.0.0/16 ge 18 le 24 is configured, it indicates that routes with the address 192.168.0.0 and mask length of 18 to 24 (including 18 and 24) are allowed to pass.
- If network/length is set to 0.0.0.0/0, it means to match the default route. If 0.0.0.0/0 le 32 is configured, it means to match all routes.
- If an implicit expression is contained at the end of an IPv4 prefix list, it means to deny all entries: deny 0.0.0.0/0 le 32. If you want to deny some routes by configuring a deny statement, it is recommended that you add a permit 0.0.0.0/0 le 32 statement to allow other IPv4 routes to pass.