天天看點

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,如需轉載請自行聯系原作者

繼續閱讀