To create a prefix list or to add a prefix-list entry, use the ip prefix-list command in global configuration mode. To delete a prefix-list entry, use the no form of this command.
ip prefix-list { list-name [ seq number ] { deny | permit } network/ length [ ge ge-length ] [ le le-length ] | description description | sequence-number }
no ip prefix-list { list-name [ seq number ] [ { deny | permit } network/ length [ ge ge-length ] [ le le-length ] ] | description description | sequence-number }
Syntax Description
list-name
|
Configures a name to identify the prefix list. Do not use the word “detail” or “summary” as a list name because they are
keywords in the
show
ip
prefix-list command.
|
seq
|
(Optional) Applies a sequence number to a prefix-list entry.
|
number
|
(Optional) Integer from 1 to 4294967294. If a sequence number is not entered when configuring this command, default sequence
numbering is applied to the prefix list. The number 5 is applied to the first prefix entry, and subsequent unnumbered entries
are incremented by 5.
|
deny
|
Denies access for a matching condition.
|
permit
|
Permits access for a matching condition.
|
network
/
length
|
Configures the network address and the length of the network mask in bits. The network number can be any valid IP address
or prefix. The bit mask can be a number from 1 to 32.
|
ge
|
(Optional) Specifies the lesser value of a range (the “from” portion of the range description) by applying the
ge-length argument to the range specified.
Note
|
The
ge keyword represents the greater than or equal to operator.
|
|
ge-length
|
(Optional) Represents the minimum prefix length to be matched.
|
le
|
(Optional) Specifies the greater value of a range (the “to” portion of the range description) by applying the
le-length argument to the range specified.
Note
|
The
le keyword represents the less than or equal to operator.
|
|
le-length
|
(Optional) Represents the maximum prefix length to be matched.
|
description
|
(Optional) Configures a descriptive name for the prefix list.
|
description
|
(Optional) Descriptive name of the prefix list, from 1 to 80 characters in length.
|
sequence-number
|
(Optional) Enables or disables the use of sequence numbers for prefix lists.
|
Command Default
No prefix lists or prefix-list entries are created.
Command Modes
Global configuration (config)
Command History
Release
|
Modification
|
12.0(3)T
|
This command was introduced.
|
12.2(33)SRA
|
This command was integrated into Cisco IOS Release 12.2(33)SRA.
|
12.2SX
|
This command is supported in the Cisco IOS Release 12.2SX train. Support in a specific 12.2SX release of this train depends
on your feature set, platform, and platform hardware.
|
Usage Guidelines
Use the ip prefix-list command to configure IP prefix filtering. Prefix lists are configured with permit or deny keywords to either permit or deny a prefix based on a matching condition. An implicit deny is applied to traffic that does
not match any prefix-list entry.
A prefix-list entry consists of an IP address and a bit mask. The IP address can be for a classful network, a subnet, or a
single host route. The bit mask is a number from 1 to 32.
Prefix lists are configured to filter traffic based on a match of an exact prefix length or a match within a range when the
ge and le keywords are used. The ge and le keywords are used to specify a range of prefix lengths and provide more flexible configuration than using only the network/ length argument. A prefix list is processed using an exact match when neither the ge nor le keyword is specified. If only the ge value is specified, the range is the value entered for the ge
ge-length argument to a full 32-bit length. If only the le value is specified, the range is from the value entered for the network/ length
argument to the le
le-length argument. If both the ge
ge-length and le
le-length keywords and arguments are entered, the range is between the values used for the ge-length and le-length arguments.
The following formula shows this behavior:
length <ge
ge-length <le
le-length <= 32
If the seq keyword is configured without a sequence number, the default sequence number is 5. In this scenario, the first prefix-list
entry is assigned the number 5 and subsequent prefix list entries increment by 5. For example, the next two entries would
have sequence numbers 10 and 15. If a sequence number is entered for the first prefix list entry but not for subsequent entries,
the subsequent entry numbers increment by 5. For example, if the first configured sequence number is 3, subsequent entries
will be 8, 13, and 18. Default sequence numbers can be suppressed by entering the no ip prefix-list command with the seq keyword.
Evaluation of a prefix list starts with the lowest sequence number and continues down the list until a match is found. When
an IP address match is found, the permit or deny statement is applied to that network and the remainder of the list is not
evaluated.
Tip |
For best performance, the most frequently processed prefix list statements should be configured with the lowest sequence numbers.
The seq
number keyword and argument can be used for resequencing.
|
A prefix list is applied to inbound or outbound updates for a specific peer by entering the neighbor
prefix-list command. Prefix list information and counters are displayed in the output of the show
ip
prefix-list command. Prefix-list counters can be reset by entering the clear
ip
prefix-list command.
Examples
In the following example, a prefix list is configured to deny the default route 0.0.0.0/0:
Router(config)# ip prefix-list RED deny 0.0.0.0/0
In the following example, a prefix list is configured to permit traffic from the 172.16.1.0/24 subnet:
Router(config)# ip prefix-list BLUE permit 172.16.1.0/24
In the following example, a prefix list is configured to permit routes from the 10.0.0.0/8 network that have a mask length
that is less than or equal to 24 bits:
Router(config)# ip prefix-list YELLOW permit 10.0.0.0/8 le 24
In the following example, a prefix list is configured to deny routes from the 10.0.0.0/8 network that have a mask length
that is greater than or equal to 25 bits:
Router(config)# ip prefix-list PINK deny 10.0.0.0/8 ge 25
In the following example, a prefix list is configured to permit routes from any network that have a mask length from 8 to
24 bits:
Router(config)# ip prefix-list GREEN permit 0.0.0.0/0 ge 8 le 24
In the following example, a prefix list is configured to deny any route with any mask length from the 10.0.0.0/8 network:
Router(config)# ip prefix-list ORANGE deny 10.0.0.0/8 le 32