Creating prefix list entries

A prefix list can include one or more rules, each defined by a sequence number, permit or deny instruction, prefix, and range of allowed prefix lengths.

Syntax:


no [ip | ipv6 prefix-list name] [seq seq-num] [permit | deny prefix / prefix-length] [ge min-length] [le max-length]

Enters a route prefix into a prefix list.

[ip | ipv6]

Specifies a list of either IPv4 (IP) or IPv6 prefixes.

name

Specifies the name of the prefix list to which this prefix will be added. If the named list does not exist, this command creates it.

To add a prefix to an existing list, specify the name of that list.

seq seq-num

Optionally specifies a sequence number for the entry.

permit

Permits the prefix when a successful match is made.

deny

Denies the prefix when a successful match is made.

prefix/prefix-length

Specifies an IPv4 or IPv6 network prefix and its mask length, in CIDR notation. For example: 10.1.4.1/24.

ge min-length

Specifies a minimum mask length of the prefix to match. min-length must have a value between 1 and 32 for IPv4, or a value between 1 and 128 for IPv6.

This value must be greater than or equal to prefix-length. If this optional parameter is not specified, its value defaults to prefix-length.

le max-length

Specifies a maximum mask length of the prefix to match. max-length must have a value between 1 and 32 for IPv4, or a value between 1 and 128 for IPv6.

This value must be greater than or equal to min-length. If this optional parameter is not specified, its value defaults to prefix-length. (If you have specified a value for min-length that is greater than prefix-length , you must explicitly specify le with a max-length value that is greater than or equal to min-length.)


no [ip | ipv6 prefix-list name]

Deletes the entire prefix list identified by name .


no [ip | ipv6 prefix-list name] [seq seq-num]

Deletes the entry with the specified sequence number from the prefix list identified by name .

Individual prefix list entries are made using separate commands in the general configuration context. All entries that have the same prefix list name are part of the same prefix list. Thus, the following commands, taken from a show running-config listing, constitute two prefix lists.


ip prefix-list "Odd"    seq 5 permit 10.1.1.1 255.255.255.0 ge 24 le 24
ip prefix-list "Odd"    seq 10 deny 10.1.2.1 255.255.255.0 ge 24 le 24
ip prefix-list "Odd"    seq 15 permit 10.1.3.1 255.255.255.0 ge 24 le 24
ip prefix-list "Odd"    seq 20 deny 10.1.4.1 255.255.255.0 ge 24 le 24
ip prefix-list "Even"    seq 5 deny 10.1.1.1 255.255.255.0 ge 24 le 24
ip prefix-list "Even"    seq 10 permit 10.1.2.1 255.255.255.0 ge 24 le 24
ip prefix-list "Even"    seq 15 deny 10.1.3.1 255.255.255.0 ge 24 le 24
ip prefix-list "Even"    seq 20 permit 10.1.4.1 255.255.255.0 ge 24 le 24
   .
   .
   .

Sequence numbers, which are optional, determine the order in which prefix list entries are evaluated during match operations. If you do not specify a sequence number for an entry, the switch uses a number that is 5 more than the highest sequence number already used in the list. (For the first entry in a prefix list, the default value of the sequence number is 5.) You can insert a new entry in a prefix list between two entries already in the list by specifying a sequence number for the new entry that is between the sequence numbers of the two existing entries.