1. 程式人生 > 實用技巧 >簡單聊聊Qos—優先順序佇列 PQ

簡單聊聊Qos—優先順序佇列 PQ

在優先順序佇列PQ中,有 高 中 普通 低四個優先順序佇列。資料包根據實現的定義放在不同的佇列中,路由器按照高 中 普通 低順序進行服務,只有高優先順序的佇列為空後,才為其他的優先順序佇列服務,以此類推,這樣能保證高優先順序資料包一定是優先服務。

實驗拓撲如下

實驗準備:

做通全網 實現內部私有地址可以和任何一個公網地址進行通訊 (R4 的環回介面 4.4.4.4 模擬私網地址) 該準備階段的過程略

PQ配置過程

R2(config)#priority-list ? 啟用PQ
<1-16> Priority list number

R2(config)#priority-list 1 ? 定義PQ序號

default Set priority queue for unspecified datagrams
interface Establish priorities for packets from a named interface
protocol priority queueing by protocol
queue-limit Set queue limits for priority queues

R2(config)#priority-list 1 pro
R2(config)#priority-list 1 protocol ?
aarp AppleTalk ARP
appletalk AppleTalk
arp IP ARP
bridge Bridging
bstun Block Serial Tunnel
cdp Cisco Discovery Protocol
clns ISO CLNS
clns_es ISO CLNS End System
clns_is ISO CLNS Intermediate System
cmns ISO CMNS
compressedtcp Compressed TCP (VJ)
decnet DECnet
decnet_node DECnet Node
decnet_router-l1 DECnet Router L1
decnet_router-l2 DECnet Router L2
dlsw Data Link Switching (Direct encapsulation only)
http HTTP
ip IP
ipv6 IPV6
ipx Novell IPX
llc2 llc2
pad PAD links

R2(config)#priority-list 1 protocol ip 配置IP協議的優先順序列表

R2(config)#priority-list 1 protocol ip ? 指定優先順序
high
medium
normal
low

R2(config)#priority-list 1 protocol ip high ? 指定優先順序為高
fragments Prioritize fragmented IP packets
gt Prioritize packets greater than a specified size
list To specify an access list
lt Prioritize packets less than a specified size
tcp Prioritize TCP packets 'to' or 'from' the specified port
udp Prioritize UDP packets 'to' or 'from' the specified port
<cr>

R2(config)#priority-list 1 protocol ip high tcp ? TCP流量
<0-65535> Port number
bgp Border Gateway Protocol (179)
chargen Character generator (19)
cmd Remote commands (rcmd, 514)
daytime Daytime (13)
discard Discard (9)
domain Domain Name Service (53)
drip Dynamic Routing Information Protocol (3949)
echo Echo (7)
exec Exec (rsh, 512)
finger Finger (79)
ftp File Transfer Protocol (21)
ftp-data FTP data connections (20)
gopher Gopher (70)
hostname NIC hostname server (101)
ident Ident Protocol (113)
irc Internet Relay Chat (194)
klogin Kerberos login (543)
kshell Kerberos shell (544)
login Login (rlogin, 513)
lpd Printer service (515)
nntp Network News Transport Protocol (119)

R2(config)#priority-list 1 protocol ip high tcp telnet

配置了一個優先順序序列 序列號為1 tcp 的telnet 流量優先順序為高

R2(config)#access-list 10 permit host 192.168.100.2 定義了一個ACL
R2(config)#priorit
R2(config)#priority-list 1 proto
R2(config)#priority-list 1 protocol ip high ?
fragments Prioritize fragmented IP packets
gt Prioritize packets greater than a specified size
list To specify an access list
lt Prioritize packets less than a specified size
tcp Prioritize TCP packets 'to' or 'from' the specified port
udp Prioritize UDP packets 'to' or 'from' the specified port
<cr>

R2(config)#priority-list 1 protocol ip high list ?
<1-199> IP access list
<1300-2699> IP expanded access list

R2(config)#priority-list 1 protocol ip high list 10 ?

定義了所有來自該ACL的流量優先順序為高
<cr>


R2(config)#priority-list 1 protocol ip medium ?
fragments Prioritize fragmented IP packets
gt Prioritize packets greater than a specified size
list To specify an access list
lt Prioritize packets less than a specified size
tcp Prioritize TCP packets 'to' or 'from' the specified port
udp Prioritize UDP packets 'to' or 'from' the specified port
<cr>

R2(config)#priority-list 1 protocol ip medium gt 1000 資料包大小大於1000優先順序為中

R2(config)#priority-list 1 interface f1/0 normal 來自埠 f0/1的流量優先順序為普通

R2(config)#priority-list 1 default low 其他流量優先順序為底

R2(config)#priority-list 1 queue-limit 20 30 40 50 指定序列深度

R2(config)#int f1/0
R2(config-if)#prio
R2(config-if)#priority-group 1 ?
<cr>
將策略應用到介面

實驗除錯:

檢查埠上的序列

R2#show interfaces f1/0
FastEthernet1/0 is up, line protocol is up
Hardware is i82543 (Livengood), address is ca01.11ec.001c (bia ca01.11ec.001c)
Internet address is 12.1.1.2/24
MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:04, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: priority-list 1 該埠和序列相關聯

檢視佇列配置

R2#show queueing priority
Current DLCI priority queue configuration:
Current priority queue configuration:

List Queue Args
1 low default
1 high protocol ip tcp port telnet
1 high protocol ip list 10
1 medium protocol ip gt 1000
1 normal interface FastEthernet1/0
1 medium limit 30
1 normal limit 40
1 low limit 50

上述為我們定義的 PQ策略

策略的檢測

R2#debug priority
Priority output queueing debugging is on 在R2上開啟debug


我們發現 ping 流量的優先順序是 low


我們看到 telnet 的流量是 high PQ 優先順序佇列的實驗就結束了

轉載於:https://blog.51cto.com/liushuo890/1065376