6.5. Prefix-list Commands

6.5.1. ip prefix-list

Command Purpose

To create a prefix list or add a prefix-list entry, use the ip prefix-list command in Global Config mode. To delete a prefix-list or an entry, use the no form of this command.

Prerequisites

Platform

Software

License

Comments

AQ-N3000

7.0

Base

AQ-N5000

7.0

Base

AQ-N6000

7.0

Base

Command Syntax

ip prefix-list WORD ( seq SEQUENCE-NUMBER | ) ( deny | permit ) ( any | A.B.C.D/M ( ge GE-LENGTH | ) ( le LE-LENGTH | ) )

( any | A.B.C.D/M ( ge GE-LENGTH | ) ( le LE-LENGTH | ) )

no ip prefix-list WORD ( seq SEQUENCE-NUMBER | ) ( deny | permit ) ( any | A.B.C.D/M ( ge GE-LENGTH | ) ( le LE-LENGTH | ) )

no ip prefix-list WORD ( seq SEQUENCE-NUMBER | )

Parameter

Parameter Description

Parameter Value

WORD

Config a name to identify the prefix list

Up to 40 characters

seq SEQUENCE-NUMBER

Applies a sequence number to a prefix-list entry. If a sequence number is not entered when configuring this command, a 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

1-65535

deny

Denies access for a matching condition

-

permit

Permits access for a matching condition

-

A.B.C.D/M

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 0 to 32

IPv4 Address and mask length in A.B.C.D/M format

ge GE-LENGTH

(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. The ge-length argument represents the minimum prefix length to be matched

1-32

le LE-LENGTH

(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. The le-length argument represents the maximum prefix length to be matched

1-32

Command Mode

Global Config

Default

No prefix lists are created.

Usage

The ip prefix-list command is used to configure IP prefix filtering. Prefix lists are configured with permit or deny keywords to either permit or deny the prefix based on the matching condition. A prefix list consists of an IP address and a bit mask. The IP address can be a classful network, a subnet, or a single host route. The bit mask is entered as a number from 1 to 32. An implicit deny is applied to traffic that does not match any prefix-list entry. Prefix lists are configured to match an exact prefix length or a prefix range. The ge and le keywords are used to specify a range of the prefix lengths to match, providing more flexible configuration than can be configured with just the network/length argument. The prefix list is processed using an exact match when neither the ge nor le keyword is entered. If only the ge value is entered, the range is the value entered for the ge ge-length argument to a full 32-bit length. If only the le value is entered, the range is from 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 falls between the values used for the ge-length and le-length arguments. The following formula shows this behavior:

Network/length < ge ge-length < le le-length <= 32.

A prefix list is configured with a name and/or sequence number. One or the other must be entered when configuring this command. If a sequence number is not entered, a default sequence number of 5 is applied to the prefix list. And subsequent prefix list entries will be increment by 5 (for example, 5, 10, 15, and onwards). If a sequence number is entered for the first prefix list entry but not subsequent entries, then the subsequent entries will also be incremented by 5 (For example, if the first configured sequence number is 3, then subsequent entries will be 8, 13, 18, and onwards). Default sequence numbers can be suppressed by entering the no form of this command with the seq keyword. Prefix lists are evaluated starting with the lowest sequence number and continues down the list until a match is made. Once a match is made that covers the network the permit or deny statement is applied to that network and the rest of the list is not evaluated.

Examples

To deny the default route 0.0.0.0/0:

Switch# configure terminal
Switch(config)# ip prefix-list abc deny 0.0.0.0/0

To permit the prefix10.0.0.0/8:

Switch# configure terminal
Switch(config)# ip prefix-list abc permit 10.0.0.0/8

To accept a mask length of up to 24 bits in routes with the prefix 192/16:

Switch# configure terminal
Switch(config)# ip prefix-list abc permit 192.168.0.0/16 le 24

To deny mask lengths greater than 25 bits in routes with the prefix 192/16:

Switch# configure terminal
Switch(config)# ip prefix-list abc deny 192.168.0.0/16 ge 25

6.5.2. ip prefix-list description

Command Purpose

To add a text description of a prefix list, use the ip prefix-list description command in global

configuration mode. To remove the text description, use the no form of this command

Prerequisites

Platform

Software

License

Comments

AQ-N3000

7.0

Base

AQ-N5000

7.0

Base

AQ-N6000

7.0

Base

Command Syntax

ip prefix-list WORD description LINE

no ip prefix-list WORD description

Parameter

Parameter Description

Parameter Value

WORD

Name of prefix list

Up to 40 characters

Command Mode

Global Config

Default

There is no description for prefix-list.

Usage

The prefix list will be created automatically if it didn’t exist.

Examples

The following example shows how to add description:

Switch# configure terminal
Switch(config)# ip prefix-list abc description Deny routes from router A

Related Commands

ip prefix-list

ip prefix-list sequence

show ip prefix-list

clear ip prefix-list

6.5.3. ip prefix-list sequence-number

Command Purpose

To enable the generation of sequence numbers for entries in a prefix list, use the ip prefix-list sequence-number command in global configuration mode. To disable this function, use the no form of this command.

Prerequisites

Platform

Software

License

Comments

AQ-N3000

7.0

Base

AQ-N5000

7.0

Base

AQ-N6000

7.0

Base

Command Syntax

ip prefix-list sequence-number

no ip prefix-list sequence-numbe

Command Mode

Global Config

Default

This command has no default behavior.

Usage

This command is used to enable sequence-number display.

Examples

The following example shows how to enable ip prefix-list sequence-number:

Switch# configure terminal
Switch(config)# ip prefix-list sequence-number

Related Commands

ip prefix-list

show ip prefix-list

clear ip prefix-list

6.5.4. show ip prefix-list

Command Purpose

To show prefix list information, use the show ip prefix-list command.

Prerequisites

Platform

Software

License

Comments

AQ-N3000

7.0

Base

AQ-N5000

7.0

Base

AQ-N6000

7.0

Base

Command Syntax

show ip prefix-list ( summary | detail | ) ( WORD | )

show ip prefix-list WORD ( seq SEQUENCE-NUMBER | A.B.C.D/M ( longer | first-match | ) | )

Parameter

Parameter Description

Parameter Value

summary

Summary of prefix lists

-

detail

Detail of prefix lists

-

WORD

Name of the prefix list

Up to 40 characters

seq SEQUENCE-NUMBER

sequence number of the entry in the prefix list

1-65535

A.B.C.D/M

IP prefix/,e.g., 35.0.0.0/8

IPv4 Address and mask length in A.B.C.D/M format

longer

Lookup the mask of prefix longer than M

-

first-match

First matched prefix

-

Command Mode

Privileged EXEC

Default

This command has no default behavior.

Usage

None

Examples

The following example shows how to display ip prefix-list:

Switch# show ip prefix-list

ip prefix-list aa: 2 entries
permit 1.1.1.0/24
permit 1.2.3.0/24

Related Commands

ip prefix-list

clear ip prefix-list

6.5.5. clear ip prefix-list

Command Purpose

To Resets the hit count of the prefix list entries, use the clear ip prefix-list command.

Prerequisites

Platform

Software

License

Comments

AQ-N3000

7.0

Base

AQ-N5000

7.0

Base

AQ-N6000

7.0

Base

Command Syntax

clear ip prefix-list ( WORD ( A.B.C.D/M | ) | )

Parameter

Parameter Description

Parameter Value

WORD

Name of the prefix list

Up to 40 characters

A.B.C.D/M

IP prefix/,e.g., 35.0.0.0/8

IPv4 Address and mask length in A.B.C.D/M format

Command Mode

Privileged EXEC

Default

None

Usage

None

Examples

The following example shows how to clear ip prefix-list:

Switch# clear ip prefix-list abc

Related Commands

ip prefix-list