Route Policy

For general information about route policy, see Route policy overview.

Using prefix lists

Prefix lists are named lists of route prefixes. They are used to match routes for inclusion in or exclusion from route policies.

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.

Entering a prefix list description

Use the following command to enter a description string into an existing prefix list:

Syntax:

[ ip | ipv6 prefix-list name ] [seq seq-num description description-string]

Enters a description into a prefix list.

[ ip | ipv6 ]



Specifies an IPv4 (IP) or IPv6 prefix list.

name

Specifies the name of the prefix list to which this description will be added. The prefix list must already exist.

seq seq-num

Optionally specifies a sequence number for the description entry. The description is attached to the prefix list entry identified by that sequence number. If the prefix list does not contain an entry with that sequence number, no description is entered.

If you do not specify a sequence number, the description is attached to the first entry in the prefix list at the time the description is entered.

description-string

Specifies a description string of up to 80 characters.

If you delete the entry to which the description is attached, the description is deleted also.

Viewing prefix lists

The show ip prefix-list command displays the content of prefix lists.

Syntax:

show [ ip | ipv6 prefix-list ] [name list-name] [ summary | detail ]

Displays the content of prefix lists.

[ ip | ipv6 ]



Specifies an IPv4 (IP) or IPv6 prefix list.

name list-name

Specifies the name of the prefix list to display. If this parameter is omitted, all prefix lists are displayed.

[ summary | detail ]



If neither summary nor detail is specified, the listing displays the name of the prefix list and each entry in the list (not including descriptions.)

If summary is specified, the listing displays the name of the list and a summary of the entries (but not the entries themselves.)

If detail is specified, the listing displays the summary information, the description (if it exists), and the entries in the list.

Example

In a switch that contains two prefix lists, a standard display looks like this:

HP Switch# show ip prefix-list

 ip prefix-list Odd: 4 entries
    seq 5 permit 10.1.1.1/24 ge 24 le 24
    seq 10 deny 10.1.2.1/24 ge 24 le 24
    seq 15 permit 10.1.3.1/24 ge 24 le 24
    seq 20 deny 10.1.4.1/24 ge 24 le 24

 ip prefix-list Even: 4 entries
    seq 5 deny 10.1.1.1/24 ge 24 le 24
    seq 10 permit 10.1.2.1/24 ge 24 le 24
    seq 15 deny 10.1.3.1/24 ge 24 le 24
    seq 20 permit 10.1.4.1/24 ge 24 le 24

A summary of the prefix lists looks like this:

HP Switch# show ip prefix-list summary

 ip prefix-list Odd: Count:4, Range-entries: 4, 
 Sequences: 5 - 20

 ip prefix-list Even: Count:4, Range-entries: 4, 
  Sequences: 5 - 20

A detailed display of one of the prefix lists looks like this:

HP Switch# show ip prefix-list name Even detail

 ip prefix-list Even: Count:4, Range-entries: 4, 
 Sequences: 5 - 20
    seq 5 deny 10.1.1.1/24 ge 24 le 24
    Description: Permit even-numbered subnets

    seq 10 permit 10.1.2.1/24 ge 24 le 24
    seq 15 deny 10.1.3.1/24 ge 24 le 24
    seq 20 permit 10.1.4.1/24 ge 24 le 24