PBR的打標籤方式:dom
R1(config)#access-list 100 permit tcp any any range 20 21tcp
R1(config)#access-list 100 permit tcp any range 20 21 any 抓取FTP流量ide
R1(config)#access-list 101 permit 6 any any eq 80測試
R1(config)#access-list 101 permit 6 any eq 80 any 抓取HTTP流量 spa
R1(config)#access-list 102 permit 6 any any eq 23 debug
R1(config)#access-list 102 permit 6 any eq 23 any 抓取Telnet流量orm
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 ip
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+特徵庫名名稱就能夠
FIFO:
查看接口的類型:
R1#sh int s1/0
修改接口爲FIFO:
R1(config)#int f0/0
R1(config-if)#no fair-queue
修改接口爲WFQ:
R1(config)#int f0/0
R1(config-if)#fair-queue
修改隊列的數量:
R1(config)#int s1/0
R1(config-if)#hold-queue 200 out 注意:出隊比入隊更重要
R1(config-if)#hold-queue 300 in
PQ:
R1(config)#priority-list 15 protocol ip high tcp telnet 把Telnet劃入high
R1(config)#access-list 100 permit icmp any any
R1(config)#priority-list 15 protocol ip low list 100 把ICMP劃入low
R1(config)#priority-list 15 protocol ip medium 把IP流量劃入medium
R1(config)#priority-list 15 interface FastEthernet0/0 medium 把經過f0/0收到的流量劃入medium
R1(config)#priority-list 15 default low 把非IP流量劃入low
調用:
R1(config)#int f0/1
R1(config-if)#priority-group 15
修改停車場的數量:
R1(config)#priority-list 15 queue-limit 50 50 50 50
測試:
R1#debug priority
CQ:
R1(config)#access-list 101 permit udp any any range 16384 32767
R1(config)#access-list 101 permit udp any range 16384 32767 any
R1(config)#queue-list 10 protocol ip 1 list 101 把語音流量放入隊列1
R1(config)#queue-list 10 protocol ip 3 tcp telnet 把Telnet放入隊列3
R1(config)#access-list 100 permit icmp any any
R1(config)#queue-list 10 protocol ip 4 list 100 把ICMP放入隊列4
R1(config)#queue-list 10 interface f0/0 5 把經過f0/0進入的流量放入隊列5
R1(config)#queue-list 10 protocol ip 6 把IP流量放入隊列6
R1(config)#queue-list 10 default 7 把全部非IP流量放入隊列7
調用:
R1(config)#int f0/1
R1(config-if)#custom-queue-list 10
注意:一個接口只能使用一種類型的隊列,不能即便用PQ又使用CQ
從隊列2開始輪循:
R1(config)#queue-list 10 lowest-custom 2
修改0號停車位的大小:
R1(config)#queue-list 10 queue 0 limit 50
修改隊列3發包的字節:
R1(config)#queue-list 10 queue 3 byte-count 3000
FBWFQ:
修改接口的下限閾值(CDT)
R1(config)#int f0/0
R1(config-if)#fair-queue 164 1024 200
R1#sh queueing fair
Reserved queues 預留隊列
Discard threshold CDT
修改HQO(上限閾值):
R1(config)#int f0/0
R1(config-if)#hold-queue 3000 out
FBLLQ:(=PQ+FBWFQ):
R1(config)#int f0/0
R1(config-if)#ip rtp priority 16384 16383 200 只能基於UDP(16384-32767之間)
注意:該命令爲隱藏命令 指這個範圍 32767=16384+16383
CBWFQ:
R1(config)#ip cef
R1(config)#class-map match-all VoIP
R1(config-cmap)#match protocol rtp audio
R1(config)#class-map match-all Video
R1(config-cmap)#match protocol rtp video
R1(config)#class-map match-all Business
R1(config-cmap)#match protocol ftp
R1(config)#class-map match-all EIGRP
R1(config-cmap)#match protocol eigrp
R1(config)#policy-map CBWFQ
R1(config-pmap)#class VoIP
R1(config-pmap-c)#bandwidth percent 30 佔用30%
R1(config-pmap)#class Video
R1(config-pmap-c)#bandwidth percent 20 佔用20%
R1(config-pmap)#class Business
R1(config-pmap-c)#bandwidth percent 30 佔用30%
R1(config-pmap)#class EIGRP
R1(config-pmap-c)#bandwidth percent 5 佔用5%
R1(config)#int f0/0
R1(config-if)#service-policy output CBWFQ 注意:只能在出戰方向調用
R1(config-if)#ip nbar protocol-discovery
CBLLQ:
R1(config)#ip cef
R1(config)#class-map match-all VoIP
R1(config-cmap)#match protocol rtp audio
R1(config)#class-map match-all Video
R1(config-cmap)#match protocol rtp video
R1(config)#class-map match-all Business
R1(config-cmap)#match protocol ftp
R1(config)#class-map match-all EIGRP
R1(config-cmap)#match protocol eigrp
R1(config)#policy-map CBLLQ
R1(config-pmap)#class EIGRP
R1(config-pmap-c)#priority 100
R1(config-pmap)#class VoIP
R1(config-pmap-c)#priority percent 20
R1(config-pmap)#class Video
R1(config-pmap-c)#bandwidth percent 30
R1(config-pmap)#class Business
R1(config-pmap-c)#bandwidth percent 30
R1(config-pmap)#class class-default
R1(config-pmap-c)#fair-queue
R1(config)#int f0/0
R1(config-if)#service-policy output CBLLQ 注意:只能在出戰方向調用
R1(config-if)#ip nbar protocol-discovery
實驗要求見QQ收藏:
R1(config)#class-map match-all Control
R1(config-cmap)#match ip precedence 6 7
R1(config)#class-map match-all Voice
R1(config-cmap)#match ip precedence 5
R1(config)#class-map match-all Video
R1(config-cmap)#match ip precedence 4
R1(config)#class-map match-all Business
R1(config-cmap)#match ip precedence 3
R1(config)#class-map match-all Internet
R1(config-cmap)#match ip precedence 0
R1(config)#policy-map CBLLQ
R1(config-pmap)#class Voice
R1(config-pmap-c)#priority percent 20
R1(config-pmap)#class Control
R1(config-pmap-c)#priority 100
R1(config-pmap)#class Video
R1(config-pmap-c)#bandwidth percent 30
R1(config-pmap)#class Business
R1(config-pmap-c)#bandwidth percent 30
R1(config-pmap-c)#random-detect
R1(config-pmap-c)#random-detect exponential-weighting-constant 10
R1(config-pmap)#class Internet
R1(config-pmap-c)#bandwidth percent 15
R1(config)#int f0/0
R1(config-if)#max-reserved-bandwidth
R1(config-if)#max-reserved-bandwidth 100
R1(config-if)#service-policy output CBLLQ