To enter prefix set
configuration mode and define a prefix set for contiguous and
non-contiguous set of bits, use the
prefix-set
command in
global
configuration mode. To remove a named prefix
set, use the
no form of
this command.
prefix-set name
no prefix-set name
Syntax Description
name
|
Name of a
prefix set.
|
Command Modes
Global
configuration
Command History
Release
|
Modification
|
Release 2.0
|
This command
was introduced.
|
Release 3.2
|
This command
was introduced.
|
Release 5.1.1
|
The
command was modified to accept IPv4 and IPv6 address and address mask to define
a prefix set.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user
group assignment is preventing you from using a command, contact your AAA administrator for assistance.
Use the
prefix-set
command to enter prefix set configuration mode and define a
prefix set.
A prefix set is a
comma-separated list of prefix match specifications. It holds IPv4 or IPv6
prefix match specifications, each of which has four parts: an address, a mask
length, a minimum matching length, and a maximum matching length. The address
is required, but the other three parts are optional. The address is a standard
four-part, dotted-decimal numeric IPv4 address or a colon-separated hexadecimal
IPv6 address. The mask length, if present, is a nonnegative decimal integer in
the range from 0 to 32 for IPv4 prefixes or 0 to 128 for IPv6 prefixes
following the address and separated from it by a slash. The optional minimum
matching length follows the address and optional mask length and is expressed
as the keyword
ge
(mnemonic for
greater than
or
equal to),
followed by a nonnegative decimal integer in the range from 0 to 32 for IPv4 or
0 to 128 for IPv6. The optional maximum matching length follows the rest and is
expressed by the keyword
le
(mnemonic for
less than or
equal to),
followed by yet another nonnegative decimal integer in the range from 0 to 32
for IPv4 or 0 to 128 for IPv6. A syntactic shortcut for specifying an exact
length for prefixes to match is the
eq
keyword, mnemonic for
equal to.
If a prefix match
specification has no mask length, then the default mask length is 32 for IPv4
or 128 for IPv6. The default minimum matching length is the mask length. If a
minimum matching length is specified, then the default maximum matching length
must be less than 32 for IPv4 prefixes or 128 for IPv6 prefixes. Otherwise, if
neither a minimum nor maximum length is specified, the default maximum length
is the mask length.
A prefix set is a list of
prefix match specifications. It holds IPv4 or IPv6 prefix match specifications,
each of which has two parts: an address and a mask. The address and mask is a
standard dotted-decimal IPv4 or colon-separated hexadecimal IPv6 address. The
prefix set allows the specifying of contiguous and non-contiguous set of bits
that mus be matched in any route. The set of bits to be matched are provided in
the form of a mask in which a binary 0 means a mandatory match and a binary 1
means a 'do not match' condition.
Task ID
Task ID
|
Operations
|
route-policy
|
read,
write
|
The following
example shows a prefix set named legal-ipv4-prefix-examples:
RP/0/RP0/CPU0:router(config)# prefix-set legal-ipv4-prefix-examples
RP/0/RP0/CPU0:router(config-pfx)# 10.0.1.1,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.2.0/24,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.3.0/24 ge 28,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.4.0/24 le 28,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.5.0/24 ge 26 le 30,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.6.0/24 eq 28
RP/0/RP0/CPU0:router(config-pfx)# end-set
The first element
of the prefix set matches only one possible value, 10.0.1.1/32 or the host
address 10.0.1.1. The second element matches only one possible value,
10.0.2.0/24. The third element matches a range of prefix values, from
10.0.3.0/28 to 10.0.3.255/32. The fourth element matches a range of values,
from 10.0.4.0/24 to 10.0.4.240/28. The fifth element matches prefixes in the
range from 10.0.5.0/26 to 10.0.5.252/30. The sixth element matches any prefix
of length 28 in the range from 10.0.6.0/28 through 10.0.6.240/28.
The following
prefix set consists entirely of invalid prefix match specifications:
RP/0/RP0/CPU0:router(config)# prefix-set INVALID-PREFIX-EXAMPLES
RP/0/RP0/CPU0:router(config-pfx)# 10.1.1.1 ge 16,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.2.1 le 16,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.3.0/24 le 23,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.4.0/24 ge 33,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.5.0/25 ge 29 le 28
RP/0/RP0/CPU0:router(config-pfx)# end-set
Neither the
minimum length nor the maximum length is legal without a mask length. The
maximum length must be at least the mask length. The minimum length must be
less than 32, the maximum length of an IPv4 prefix. The maximum length must be
equal to or greater than the minimum length.
The following
example shows a valid IPv6 prefix set named legal-ipv6-prefix-examples:
RP/0/RP0/CPU0:router(config)# prefix-set legal-ipv6-prefix-examples
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:1::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:2::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:3::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:4::/64
RP/0/RP0/CPU0:router(config-pfx)# end-set
This example shows
a prefix set named legal-ipv4-prefix:
RP/0/RP0/CPU0:router(config)# prefix-set legal-ipv4-prefix
RP/0/RP0/CPU0:router(config-pfx)# 10.1.1.1 0.255.0.255
RP/0/RP0/CPU0:router(config-pfx)# 10.2.2.2 0.0.0.0
RP/0/RP0/CPU0:router(config-pfx)# 10.3.3.3 255.255.255.254
RP/0/RP0/CPU0:router(config-pfx)# 10.4.4.4 255.255.255.255
In the above
example, In the above example, the command defines the prefix-set named
acl-prefix-set. The first element specifies to match all routes having 10 in
first octet and 1 in third octet. The second element matches all routes having
prefix as 10.2.2.2 (that is, matches all conditions). The third element matches
all routes having odd numbers in the last octets and the fourth element matches
all routes with any prefix.