288
Establish a class rule and apply different policies on different kinds of data streams
thereafter.
Config policymap
A policymap can be established after the data streams are classified. Assign each stream
to previously created classmap and then enter the policy classmap mode. In this way
different data streams can now be assigned to different next-hop IP address and apply
the policy to the port.
Apply policymap
A policy will not be valid until it is bonded to a specified port.
9.2.3 PBR examples
On port ethernet 1/1, apply policy-based routing on packages from 192.168.1.0/24
segment, and set the next-hop as 218.31.1.119, meanwhile the local network IP of this
network ranges within 192.168.0.0/16. To assure normal communication in local network,
messages from 192.168.1.0/24 to local IP 192.168.0.0/16 are not applied with policy
routing.
Configuration procedure is as follows:
Switch#config
Switch(config)#access-list ip extended a1
Switch(Config-IP-Ext-Nacl-a1)#permit ip 192.168.1.0 0.0.0.255 any-destination
Switch(Config-IP-Ext-Nacl-a1)#deny ip 192.168.1.0 0.0.0.255 192.168.0.0 0.0.255.255
Switch(Config-IP-Ext-Nacl-a1)#exit
Switch(config)#mls qos
Switch(config)#class-map c1
Switch(config-ClassMap)#match access-group a1
Switch(config-ClassMap)# exit
Switch(config)#policy-map p1
Switch(config-PolicyMap)#class c1
Switch(config-Policy-Class)#set ip nexthop 218.31.1.119
Switch(config--Policy-Class)#exit
Switch(config-PolicyMap)#exit
Switch(config)#interface ethernet
Switch(Config-Ethernet1/1)#service-policy input p1
Configuration results