Prefix Lists
A prefix list is a sequential collection of permit and deny conditions that apply to IP or IPv6 addresses. Like an access list, the router tests addresses one by one against the conditions in a prefix list. The first match determines whether the router accepts or rejects the address. Because the router stops testing conditions after the first match, the order of the conditions is critical. If no conditions match, the router rejects the address. An empty prefix list results in an automatic permit of the tested address.
Unlike access lists, the prefix list specifies a base IP or IPv6 address and a length (the number of bits applied to the base to determine the network prefix). The tested address is matched against the prefix.
Use the ip prefix-list command to define an IP prefix list, or the ipv6 prefix-list command to define an IPv6 prefix list. The prefix-list keyword with either the match { ip | ipv6 } address or match { ip | ipv6 } next-hop commands allow you to add a clause to a route map.
Using a Prefix List
The following example creates a prefix list that permits routes with a prefix length up to 24 in the 151.0.0.0/8 network:
host1(config)#ip prefix-list abc permit 151.0.0.0/8 le 24clear ip prefix-list
- Use to clear all hit counts in the prefix lists, or the specified entry from the specified prefix list. (The hit count is incremented +1 each time an entry matches.)
- Example
host1#clear ip prefix-list abcThere is no no version. clear ipv6 prefix-list
- Use to clear all hit counts in the IPv6 prefix lists, or the specified entry from the specified prefix list. (Each match results in the hit count incrementing by 1.)
- Example
host1#clear ipv6 prefix-list abcThere is no no version. ip prefix-list
- Use to create a prefix list for route filtering and to specify a list entry—a deny or permit clause for a network address—to the prefix list. Use to add entries to prefix lists.
- The prefix list name can be up to 32 characters long.
- Specify the position of each entry in the list with the seq keyword. If a sequence number is not specified, the value of the last sequence number plus 5 is used.
- Use the ge and le keywords to specify a range of network prefixes. These keywords have the following values:
- If you do not specify either ge or le, an exact match is expected. For example, if you issue the following command, only a route with a prefix length of 8 and a network address of 151.0.0.0 is permitted.
host1(config)#ip prefix-list abc permit 151.0.0.0/8Use the no version to remove the specified prefix list or the specified list entry. ipv6 prefix-list
- Use to create an IPv6 prefix list for route filtering and to specify a list entry—a deny or permit clause for a network address—to the prefix list. Use to add entries to prefix lists.
- The prefix list name can be up to 32 characters long.
- Specify the position of each entry in the list with the seq keyword. If a sequence number is not specified, the value of the last sequence number plus 5 is used.
- Use the ge and le keywords to specify a range of network prefixes. These keywords have the following values:
- If you do not specify either ge or le, an exact match is expected. For example, if you issue the following command, only a route with a prefix length of 8 and a network address of 1:0:0:0:0:0:0:5 is permitted.
host1(config)#ipv6 prefix-list abc permit 1::5/8Use the no version to remove the specified prefix list or the specified list entry. match ip address
- Specify an access-list or use with the prefix-list or prefix-tree keyword to match routes that have a destination network number address that is permitted by any specified access lists, prefix lists, or prefix trees.
- Example
host1(config-route-map)#match ip address prefix-list abcUse the no version to delete the match clause from a route map or a specified value from the match clause. match ipv6 address
- Use to match any routes that have a destination network number address that is permitted by the specified access list or prefix list.
- Example
host1(config-route-map)#match ipv6 address prefix-list bostonUse the no version to delete all address match clauses from a route map unless you specify an access list or prefix list, in which case only the list match is removed from the route map. match ip next-hop
- Use with the prefix-list keyword to match routes that have a next-hop router address passed by the specified access lists, prefix lists, or prefix trees.
- Example
host1(config-route-map)#match ip next-hop prefix-list abcUse the no version to delete the match clause from a route map or a specified value from the match clause. match ipv6 next-hop
- Use to match any routes that have a next-hop router address passed by the specified access list or prefix list.
- Example
host1(config-route-map)#match ipv6 next-hop prefix-list next1Use the no version to delete all next-hop match clauses from a route map unless you specify an access list or prefix list, in which case only the list match is removed from the route map.