5.4. Configuring Prefix-list

Overview

Function Introduction

Routing Policy is the technology for modifying route information to change traffic route. Prefix list is a kind of route policies that used to control and modify routing information. A prefix list is identified by list name and contains one or more ordered entries which are processed sequentially. Each entry provides a matched range for network prefix and has a unique sequence number in the list. In the matching process switch will check entries orderly. If a entry matches conditions, this process would finish.

Principle Description

N/A

Configuration

Basic Configuration

step 1 Enter the configure mode

Switch# configure terminal

step 2 Create a prefix-list

Note: Create a prefix-list. If the sequence of the rule is not specified, system should automatically assign an sequence number for it. Support different actions such as permit and deny. Support to add description string for a prefix-list.

Switch(config)# ip prefix-list test seq 1 deny 35.0.0.0/8 le 16
Switch(config)# ip prefix-list test permit any
Switch(config)# ip prefix-list test description this prefix list is fot test
Switch(config)# ip prefix-list test permit 36.0.0.0/24

step 3 Exit the configure mode

Switch(config)# end

step 4 Validation

Use the following command to display the prefix-list:

Switch# show ip prefix-list detail
Prefix-list list number: 1
Prefix-list entry number: 3
Prefix-list with the last deletion/insertion: test
ip prefix-list test:
Description: this prefix list is fot test
count: 3, range entries: 0, sequences: 1 - 10
seq 1 deny 35.0.0.0/8 le 16 (hit count: 0, refcount: 0)
seq 5 permit any (hit count: 0, refcount: 0)
seq 10 permit 36.0.0.0/24 (hit count: 0, refcount: 0)

Used by rip

step 1 Enter the configure mode

Switch# configure terminal

step 2 Create a prefix-list

Switch(config)# ip prefix-list aa seq 11 deny 35.0.0.0/8 le 16
Switch(config)# ip prefix-list aa permit any

step 3 Apply the prefix-list under the router rip configure mode

Switch(config)# router rip
Switch(config-router)# distribute-list prefix aa out
Switch(config-router)# exit

step 5 Exit the configure mode

Switch(config)# end

step 6 Validation

Use the following command to display the prefix-list:

Switch# show ip prefix-list
ip prefix-list aa: 2 entries
seq 11 deny 35.0.0.0/8 le 16
seq 15 permit any

Use the following command to display the configuration of the device:

Switch# show running-config
Building configuration\...
...
ip prefix-list aa seq 11 deny 35.0.0.0/8 le 16
ip prefix-list aa seq 15 permit any
...
router rip
distribute-list prefix aa out

Used by Route-map

step 1 Enter the configure mode

Switch# configure terminal

step 2 Create a prefix-list

Switch(config)# ip prefix-list aa seq 11 deny 3.3.3.0/8 le 24
Switch(config)# ip prefix-list aa permit any

step 3 create a route map to match the prefix-list

Switch(config)# route-map abc permit
Switch(config-route-map)# match ip address prefix-list aa
Switch(config-route-map)# set local-preference 200
Switch(config-route-map)# exit
Switch(config)# route-map abc permit 20
Switch(config-route-map)# exit

step 4 Apply the route under the router bgp configure mode

Switch(config)# router bgp 1
Switch(config-router)# neighbor 1.1.1.2 remote-as 1
Switch(config-router)# neighbor 1.1.1.2 route-map abc out
Switch(config-router)# network 2.2.2.2/32
Switch(config-router)# network 3.3.3.3/32

step 5 Exit the configure mode

Switch(config-router)# end

step 6 Validation

Use the following command to display the route map:

Switch# show route-map
route-map abc, permit, sequence 10
Match clauses:
ip address prefix-list aa
Set clauses:
local-preference 200
route-map abc, permit, sequence 20
Match clauses:
Set clauses:

Use the following command to display the configuration of the device:

Switch# show running-config
Building configuration...
...
ip prefix-list aa seq 11 deny 3.3.3.0/8 le 24
ip prefix-list aa seq 15 permit any

 !
 !

route-map abc permit 10
match ip address prefix-list aa
set local-preference 200

 !

route-map abc permit 20
...
router bgp 1
neighbor 1.1.1.2 remote-as 1

 !

address-family ipv4
no synchronization
network 2.2.2.2 mask 255.255.255.255
network 3.3.3.3 mask 255.255.255.255
neighbor 1.1.1.2 activate
neighbor 1.1.1.2 route-map abc out
exit-address-family

 !

address-family vpnv4 unicast
no synchronization
exit-address-family

Application cases

N/A