在优先级队列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 优先级队列的实验就结束了