天天看点

QOS 之 queueing

1、FIFO QUEUE

2、WFQ QUEUE

3、PRIORITY QUEUE

4、CUSTOM QUEUE

5、CLASS BASED WEIGHTED FAIR QUEUE

6.   Low latency queuing(LLQ)

7.  CLASS BASED   Low latency queuing

默认情况下<=E1的线路默认启用的就是WFQ,E1=2.048M,大于E1默认就是FIFO。

分类:WFO加权队列,是基于flow的形式默认分类的,不需要人工干预。默认的是WFO丢弃不是尾丢弃,我们要明白两个概念 class and flow class 手工定义classification  making像PQ CQ, 而flow基于sou ip  des ip tcp/udp port transport protocol TOS.默认是256个flow。

明白这两个概念:congestive discard threshold (CDT)

                                  Hold-Queue Out limit (HQL)

加队:early droping when the congestive discard thresold (CDT)is reached

aggressive droping when the hold-queue out limit (HQO)is reached

也就是说有个一个数据包进入缓存经过flow进入也一个队列,包的个数大于CDT,如果这个队列已满,直接drop,没有满insert,包的个数大于HQL,队列已满 drop 不是最长队列的包,会aggerssive drop 最长队列的那个包,这个数据包insert

调度:finish time=real packet size/(ip precedent+1) FT最小的先发送

看个例子:

<a target="_blank" href="http://blog.51cto.com/attachment/201104/114031661.png"></a>

A1 的FT=50 A2=60 B1=100 B2=150

所以顺序是 A1  A2  B1  B2

其实making优先级是没有作用,关键我们要看action 在低速链路上我们默认的队列机制是WFQ 所以语音的ip pre5 有高的优先级,看以先走

R2#show int s1/0

Serial1/0 is up, line protocol is up 

  Hardware is M4T

  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation HDLC, crc 16, loopback not set

  Keepalive set (10 sec)

  Restart-Delay is 0 secs

  Last input 00:00:50, output 00:00:02, 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: weighted fair       默认的WFQ

  Output queue: 0/1000/64/0 (size/max total/threshold/drops) 64 CDT  HQL 1000 

     Conversations  0/1/256 (active/max active/max total)   总共flow的个数

     Reserved Conversations 0/0 (allocated/max allocated)

     Available Bandwidth 1158 kilobits/sec

  5 minute input rate 0 bits/sec, 0 packets/sec

  5 minute output rate 0 bits/sec, 0 packets/sec

     1 packets input, 332 bytes, 0 no buffer

     Received 1 broadcasts, 0 runts, 0 giants, 0 throttles

     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort

     3 packets output, 646 bytes, 0 underruns

     0 output errors, 0 collisions, 1 interface resets

     0 output buffer failures, 0 output buffers swapped out

     2 carrier transitions     DCD=up  DSR=up  DTR=up  RTS=up  CTS=up

R2(config-if)#fair-queue 128 1024  37 (CDT  动态Q   RSVP )

                                      64   256   0  (默认)

R2(config-if)#hold-queue 2000 out    HQO

R2#show queueing fair 

Current fair queue configuration:

  Interface           Discard    Dynamic  Reserved  Link    Priority

                      threshold  queues   queues    queues  queues

  Serial1/0           128        1024     37        8       1    

  Serial1/1           64         256      0         8       1    

  Serial1/2           64         256      0         8       1    

  Serial1/3           64         256      0         8       1  

PQ:介绍

priority queueing 默认有四个优先级,默认的是尾丢弃,高优先级的先出去,等优先级高的队列发出去完了在发送下面的队列,这个不足容易造成低优先级的队列饿死!

Router(config)#priority-list 2 ?

  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   限制优先级队列的大小

1\HIGH

2\MEDIUM

3\NORMAL

4\LOW

access-list 110 permit gre any any

access-list 110 permit ip any host 192.168.1.100

priority-list 1 protocol ip high list 110

priority-list 1 protocol ip medium tcp smtp

priority-list 1 protocol ip normal udp ntp

priority-list 1 protocol ip low tcp www

priority-list 1 queue-limit 40 20 20 20    (20 40 60 80默认)

interface Serial1/0

  priority-group 1

Router#show queueing priority 

Current DLCI priority queue configuration:

Current priority queue configuration:

List   Queue  Args

1      high   protocol ip          list 110

1      medium protocol ip          tcp port smtp

1      normal protocol ip          udp port ntp

1      low    protocol ip          tcp port www

1      high   limit 40

1      medium limit 20

1      normal limit 20

1      low    limit 20

Router#show int s1/0

 Queueing strategy: priority-list 1

  Output queue (queue priority: size/max/drops):

     high: 0/40/0, medium: 0/20/0, normal: 0/20/0, low: 0/20/0

CQ 介绍:尾丢弃 调度轮询调度 17个class

R2(config)#queue-list 1 ?

  default        Set custom queue for unspecified datagrams

  interface      Establish priorities for packets from a named interface   基于接口

  lowest-custom  Set lowest number of queue to be treated as custom  默认0是先执行 我们在这可以设置

  protocol       priority queueing by protocol                                    基于协议

  queue          Configure parameters for a particular queue     对queue配置响应的参数

   stun           Establish priorities for stun packets  

access-list 110 permit ip any any precedence critical

queue-list 1 interface Ethernet0/0 2

queue-list 1 protocol ip 3 tcp www

queue-list 1 protocol ip 3 list 110

queue-list 1 queue 2 limit 3000

queue-list 1 queue 3 limit 3000

 no ip address

 serial restart-delay 0

 custom-queue-list 1

R2#show queueing custom 

Current custom queue configuration:

1      2      interface Ethernet0/0         

1      3      protocol ip          tcp port www

1      3      protocol ip          list 110

1      2      limit 3000

1      3      limit 3000

R2(config)#queue-list 1 lowest-custom 2   队列0 1 是优先级最高的相当于PQ+CQ

LLQ 介绍 :对语音流量设置优先 相当于PQ+WFQ

在WFQ的基础之上设置

this is used for links with speed less than 1.544Mbps(T1)

R1(config)#int s1/0

R1(config-if)#ip rtp

R1(config-if)#ip rtp pr

R1(config-if)#ip rtp priority ?

  &lt;2000-65535&gt;  Lower bound of UDP destination port

R1(config-if)#ip rtp priority 16384 16383  ?

R1(config-if)#ip rtp priority 16384 16383 ?

  &lt;0-2000&gt;  Maximum allowed bandwidth in kbps

R1(config-if)#ip rtp priority 16384 16383 100(为语音预留的带宽)

CLASS BASED WEIGHTED FAIR QUEUE介绍:

 64+1(default)  手工分类+制定带宽    尾丢弃   轮询转发

bandwidth 

bandwidth percent  总带宽的百分比

bandwidth remaining percent  实际可用的带宽百分比(总带宽的百分比*0.75*Y%)

bandwith(av)=bandwith(total)*0.75—MWrtp

class-map match-all VTOP  

 match ip rtp 16384 16383

用NBAR抓的流量 用NBAR抓流量是比较简单的,可以根据特定的协议去抓

我们还可以用ACL抓流量

(access-list 110 permit ip any any precedence 5

class-map match-all VTOP

match access-group 110)

class-map match-all WWW

 match protocol http

policy-map CBWFQ

 class VTOP

  bandwidth percent 50

 class WWW

  bandwidth percent 20

 class class-default

  bandwidth percent 30

 R2(config-if)#max-reserved-bandwidth 100

no ip address

 max-reserved-bandwidth 100

 service-policy output CBWFQ

 hold-queue 2000 out

我们还可以在默认的定义为WFQ

class class-default

fair-queue

LLQ

low-latency queueing 低延迟队列 相当于WFQ+PQ 首先接口队列要是WFQ

max-reserved-bandwith percent(%)

实际带宽=全部带宽*75%-带宽RTP(为语音预留的带宽)

CBLLQ 可以设置PQ让其优先 有PQ你就先走

class VTOP

 priority  percent 50  强制优先

 本文转自q狼的诱惑 51CTO博客,原文链接:http://blog.51cto.com/liangrui/551863,如需转载请自行联系原作者

继续阅读