PBR的打标签方式:
R1(config)#access-list 100 permit tcp any any range 20 21
R1(config)#access-list 100 permit tcp any range 20 21 any 抓取FTP流量
R1(config)#access-list 101 permit 6 any any eq 80
R1(config)#access-list 101 permit 6 any eq 80 any 抓取HTTP流量
R1(config)#access-list 102 permit 6 any any eq 23
R1(config)#access-list 102 permit 6 any eq 23 any 抓取Telnet流量
R1(config)#access-list 103 permit 17 any any range 16384 32767
R1(config)#access-list 103 permit 17 any range 16384 32767 any 抓取VoIP流量
R1(config)#access-list 104 permit 88 any host 224.0.0.10
R1(config)#access-list 104 permit 88 host 224.0.0.10 any 抓取EIGRP流量
R1(config)#route-map PBR permit 10
R1(config-route-map)#match ip address 100
R1(config-route-map)#set ip precedence 1 定义ip precedence值
R1(config-route-map)#exit
R1(config)#route-map PBR Permit 20
R1(config-route-map)#match ip add 101
R1(config-route-map)#set ip precedence 2 定义ip precedence值
R1(config-route-map)#ex
R1(config)#route-map PBR permit 30
R1(config-route-map)#match ip add 102
R1(config-route-map)#set ip precedence 3 定义ip precedence值
R1(config-route-map)#ex
R1(config)#route-map PBR permit 40
R1(config-route-map)#match ip add 103
R1(config-route-map)#set ip precedence 5 定义ip precedence值
R1(config-route-map)#ex
R1(config)#route-map PBR permit 50
R1(config-route-map)#match ip add 104
R1(config-route-map)#set ip precedence 6 定义ip precedence值
R1(config-route-map)#ex
R1(config)#int f0/0
R1(config-if)#ip policy route-map PBR 在接口调用
注意:该调用只能对通过该接口接收到的流量生效(入站流量有效)
CBMarking抓取流量:
使用ACL抓取条目
ip access-list extended EIGPR
permit eigrp any any
ip access-list extended FTP
permit tcp any any range ftp-data ftp
permit tcp any range ftp-data ftp any
ip access-list extended HTTP
permit tcp any any eq www
permit tcp any eq www any
ip access-list extended Telnet
permit tcp any any eq telnet
permit tcp any eq telnet any
ip access-list extended VoIP
permit udp any any range 16384 32767
permit udp any range 16384 32767 any
使用Class-map将ACL抓取到的流量分类
class-map match-all HTTP
match access-group name HTTP
class-map match-all VoIP
match access-group name VoIP
class-map match-all Telnet
match access-group name Telnet
class-map match-all FTP
match access-group name FTP
class-map match-all EIGRP
match access-group name EIGRP
使用Policy-map对已经分类的流量执行Qos策略
policy-map CBMarking
class FTP
set ip precedence 1
class HTTP
set ip dscp cs2
class Telnet
set ip dscp af31
class VoIP
set ip dscp ef
class EIGRP
set ip dscp cs6
在接口上调用:
interface FastEthernet0/1
service-policy input CBMarking 入站
interface FastEthernet0/0
service-policy output CBMarking 出战
NBAR国家禁黄专用:
R1(config)#class-map match-all BNAR-VoIP
R1(config-cmap)#match protocol rtp audio
R1(config)#int f0/0
R1(config-if)#ip nbar protocol-discovery
注意:使用之前需要先到思科官网下载特征库,然后放入flash中,全局下使用ip nbar pdlm+特征库名名称就可以