Quality of Service (QoS) on Switch 交換器的服務品質

前言

Switch 的 Qos 理論跟 Router 相若,仍涉及 Classification、Marking、Queuing 及 Congestion Avoidance 等題目,但在設定上卻比較複雜,必需先從 Switch 的結構開始探討,才能準確理解每一道設定指令。閱讀本文章前,建議讀者先了解:QoS on RouterBandwidth Management 及 Virtual LAN 等文章。

Switch 的結構 

如圖所示,用 QoS 的角度去理解一隻 Switch,可簡單分成 4 個部份:

qos-switch

1. Ingress Features

當 Data Frame 進入 Switch 的 Interface 後,會進行 Classification 及 Marking,也可同時做 Policing,關於這 3 個 Features 的詳細理論,請參考 QoS on Router 及 Bandwidth Management 教學。但需要留意在 Router 即 Layer 3 層面,IP Packet 利用 Header 裡的 IPP 或 DSCP 來判斷 Packet「重要性」,來到 Layer 2 Switch 的 Data Frame Header 裡有多一個選擇,就是 CoS (Class of Service)。CoS 是放在 802.1q tag 裡的一組 3 Bits 長度的標籤,結構跟 IPP 很相似,由 0 至 7 代表 Data Frame 的重要性。只有 802.1q Trunk 才能支緩 CoS,關於 802.1q 的教學文件請看這裡

2. Ingress Queuing

一般低至中階的 Switch 只有兩條 Ingress Queue 給所有 Interface 共用,Data Frame 會跟據設定被送到這兩條 Queue 等待被送出。Router 所使用的 Scheduler 是 WRR (Weighted Round Robin),而 Switch 用的是 SRR (Shared Round Robin),玩法有點不同,稍後說明。

3. Switching Fabric

Data Frame 被送上 Switching Fabric,並以非常高的速度被送到它要去的 Outgoing Interface 之 Egress Queue,至於 Switching Fabric 的奧秘可留給電子工程師研究,作為網絡工程師不用深究。

4. Egress Queuing

低至中階的 Switch 每個 Interface 有 4 條 Egress Queue,Data Frame 會跟據設定被安排在 Queue 中等待被送上 Outgoing Interface 然後送走。

啟動 QoS

Switch 的 QoS 預設是關閉的。

SW#show mls qos
QoS is disabled
QoS ip packet dscp rewrite is enabled

mls qos 指令去開啟 QoS 功能。

SW(config)#mls qos
SW(config)#end
SW#show mls qos
QoS is enabled
QoS ip packet dscp rewrite is enabled

Ingress

把 Switch 結構分成兩部份去看,Switching Fabric 左邊為 Ingress 部份,而右邊則為 Egress。先集中看看 Ingress 的部份,當 Data Frame 從 Interface 進來後,可以先應用以下一些 Ingress Features。

Classification & Marking

我們可以用 MQC 指令 (只能應用在 Ingress),即 class-map 與 policy-map 做 Classifcation 及 Marking,在 QoS on Router 的文章已解釋過了,不在此重覆。由於 Switch 接駁著 End User 的設備,由它們傳來的 Data Frame 有機會已被寫上 CoS、IPP 或 DSCP,Switch 可以選擇是否相信 (Trust) 這些 Marking,如不相信則可覆寫 (Override) 其 Marking。

SW#show mls qos interface fastEthernet 1/0/13
FastEthernet1/0/13
trust state: not trusted
trust mode: not trusted
trust enabled flag: ena
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
qos mode: port-based

原設定為 Not Trust,即 CoS 預設歸 0。使用指令 mls qos trust cos

SW(config)#interface fa 1/0/13
SW(config-if)#mls qos trust cos
SW(config-if)#end
SW#
SW#show mls qos interface fastEthernet 1/0/13
FastEthernet1/0/13
trust state: trust cos
trust mode: trust cos
trust enabled flag: ena
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
qos mode: port-based

更進階的設定為只相信 Cisco IP Phone 傳來的 CoS,使用指令 mls qos trust device cisco-phone 後,如對方並非 Cisco IP Phone,則 trust state 會變成 not trusted。

SW(config-if)#mls qos trust device cisco-phone
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13
FastEthernet1/0/13
trust state: not trusted
trust mode: trust cos
trust enabled flag: dis
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: cisco-phone
qos mode: port-based

在非 802.1q Trunk 的情況下 (如 Access Port 或 Route Port),當然應使用 trust dscp 或 ip-precedence 啦。

SW(config-if)#mls qos trust dscp
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13
FastEthernet1/0/13
trust state: trust dscp
trust mode: trust dscp
trust enabled flag: ena
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
qos mode: port-based

default COS 0 的意思是沒有提供 CoS 值則歸 0,可用 mls qos cos 更改。如選擇不相信 User 的設備,可另加 mls qos cos override 把全部 data frame 的 CoS 換掉。

SW(config-if)#mls qos cos 5
SW(config-if)#mls qos cos override
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13
FastEthernet1/0/13
trust state: not trusted
trust mode: not trusted
trust enabled flag: ena
COS override: ena
default COS: 5
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
qos mode: port-based

為了讓 CoS 與 DSCP (或 IPP) 一致,決定了 Data Frame 的 CoS 值後,Switch 會根據 CoS-DSCP Table 去更改 IP Packet 裡的 DSCP 值。我們可用 show mls qos maps cos-dscp 查看這個 Table。因此,CoS 0 時 DSCP 就被設為 0,CoS 1 時 DSCP 被設為 8,如此類推。

SW#show mls qos maps cos-dscp
   Cos-dscp map:
        cos:   0  1  2  3  4  5  6  7
     --------------------------------
       dscp:   0  8 16 24 32 40 48 56

此設定有問題的地方是:IP Phone 一般把 CoS 設為 5,而 Voice Traffic 我們希望其 DSCP 為 46 (EF),因此可以把 CoS-DSCP Table 修改一下。

SW(config)#mls qos map cos-dscp 0 8 16 24 32 46 48 56
SW(config)#end
SW#show mls qos maps cos-dscp
   Cos-dscp map:
        cos:   0  1  2  3  4  5  6  7
     --------------------------------
       dscp:   0  8 16 24 32 46 48 56

同樣道理,如果 Trust DSCP 的話,Switch 也會根據 DSCP-CoS Table 把 CoS 修改。

SW#show mls qos maps dscp-cos
   Dscp-cos map:
     d1 :  d2 0  1  2  3  4  5  6  7  8  9
     ---------------------------------------
      0 :    00 00 00 00 00 00 00 00 01 01
      1 :    01 01 01 01 01 01 02 02 02 02
      2 :    02 02 02 02 03 03 03 03 03 03
      3 :    03 03 04 04 04 04 04 04 04 04
      4 :    05 05 05 05 05 05 05 05 06 06
      5 :    06 06 06 06 06 06 07 07 07 07
      6 :    07 07 07 07

Policing

我們可以透過 MQC 設定 Policing,由於在 Bandwidth Management 的文章中已詳細介紹過 Policing 的理論及設定,不在此重覆。

SW(config)#policy-map policy-policing
SW(config-pmap)#class class-default
SW(config-pmap-c)#police 10000000 8000 exceed-action drop
SW(config-pmap-c)#exit
SW(config)#int fastEthernet 1/0/13
SW(config-if)#service-policy input policy-policing

除了絕情地 Drop 掉,也可選擇把 DSCP 降低然後傳送。

SW(config-pmap-c)#police 10000000 8000 exceed-action policed-dscp-transmit

至於降低多少呢?Switch 是依據 Policed-DSCP Map Table 來控制。

SW#show mls qos maps policed-dscp
   Policed-dscp map:
     d1 :  d2 0  1  2  3  4  5  6  7  8  9
     ---------------------------------------
      0 :    00 01 02 03 04 05 06 07 08 09
      1 :    10 11 12 13 14 15 16 17 18 19
      2 :    20 21 22 23 24 25 26 27 28 29
      3 :    30 31 32 33 34 35 36 37 38 39
      4 :    40 41 42 43 44 45 46 47 48 49
      5 :    50 51 52 53 54 55 56 57 58 59
      6 :    60 61 62 63

上表為預設的 Policed-DSCP Map Table 值,即完全不改變。假設現在我們想把原 DSCP 值 24 降至 14,指令如下。

SW(config)#mls qos map policed-dscp 24 to 14
SW(config)#end
SW#show mls qos maps policed-dscp
   Policed-dscp map:
     d1 :  d2 0  1  2  3  4  5  6  7  8  9
     ---------------------------------------
      0 :    00 01 02 03 04 05 06 07 08 09
      1 :    10 11 12 13 14 15 16 17 18 19
      2 :    20 21 22 23 14 25 26 27 28 29
      3 :    30 31 32 33 34 35 36 37 38 39
      4 :    40 41 42 43 44 45 46 47 48 49
      5 :    50 51 52 53 54 55 56 57 58 59
      6 :    60 61 62 63

Queuing

完成 Ingress Features 後,Data Frame 就會進入 Queuing。Switch 會跟據 Cos-inputq-threshold Map 和 Dscp-inputq-threshold Map 把 Frame 放進 Queue 1 (Q1) 或 Queue 2 (Q2)。請先看預設值。

SW#show mls qos maps cos-input-q
   Cos-inputq-threshold map:
              cos:  0   1   2   3   4   5   6   7
              ------------------------------------
  queue-threshold: 1-1 1-1 1-1 1-1 1-1 2-1 1-1 1-1

SW#
SW#show mls qos maps dscp-input-q
   Dscp-inputq-threshold map:
     d1 :d2    0     1     2     3     4     5     6     7     8     9
     ------------------------------------------------------------
      0 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      1 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      2 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      3 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      4 :    02-01 02-01 02-01 02-01 02-01 02-01 02-01 02-01 01-01 01-01
      5 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      6 :    01-01 01-01 01-01 01-01

暫時只需看 hyphen – 前面的數字,舉例:CoS 5 會被放進 Q2,DSCP 24 會被放進 Queue 1。更改方法如下:

例如把 CoS 6 和 7 都放進 Q2。

SW(config)#mls qos srr-queue input cos-map queue 2 6 7
SW(config)#end
SW#show mls qos maps cos-input-q
   Cos-inputq-threshold map:
              cos:  0   1   2   3   4   5   6   7
              ------------------------------------
  queue-threshold: 1-1 1-1 1-1 1-1 1-1 2-1 2-1 2-1

把 DSCP 50 至 54 都放進 Q2。

SW(config)#mls qos srr-queue input dscp-map queue 2 50 51 52 53 54
SW(config)#end
SW#show mls qos maps dscp-input-q
   Dscp-inputq-threshold map:
     d1 :d2    0     1     2     3     4     5     6     7     8     9
     ------------------------------------------------------------
      0 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      1 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      2 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      3 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01
      4 :    02-01 02-01 02-01 02-01 02-01 02-01 02-01 02-01 01-01 01-01
      5 :    02-01 02-01 02-01 02-01 02-01 01-01 01-01 01-01 01-01 01-01
      6 :    01-01 01-01 01-01 01-01

問題是我們為什麼要大費周章地把 Frame 分門別類放進兩條 Queue 呢?因為兩條 Queue 所得的資源 (Buffer) 不同,簡單來說兩條 Queue 的長度不同,我們都知道 Queue 排滿了便會發生 Tail Drop。因此,Queue 的資源分配可以影響 Frame 的傳送速度及成功率。用 show mls qos input-queue 可查看 Buffer 原設定值。

SW#show mls qos input-queue
Queue     :       1       2
----------------------------------------------
buffers   :      90      10
bandwidth :       4       4
priority  :       0      10
threshold1:     100     100
threshold2:     100     100

以上可見,Queue 1 預設得到 90% Buffer,而 Queue 2 預設得到 10% Buffer。那麼 Buffer 的總數究竟是多少呢?各款型號不同,這要看看產品的 Datasheet 了,但並不重要。以下指令可更改百份比。

SW(config)#mls qos srr-queue input buffers 80 20
SW(config)#end
SW#show mls qos input-queue
Queue     :       1       2
----------------------------------------------
buffers   :      80      20
bandwidth :       4       4
priority  :       0      10
threshold1:     100     100
threshold2:     100     100

Scheduler

Frame 在 Q1 和 Q2 排隊,等待被 Scheduler 送上 Switching Fabric。話說 Switch 預設把 Q2 設為 Priority Queue (PQ),被放在 Q2 的 Frame 會被優先處理。按照預設值來看,Scheduler 預設會分配 10% Bandwidth 給 PQ。例如:Switching Fabric 每秒能處理 10G 流量,就會把 1G 配給 PQ,剩餘的 9G 則按 4:4 的比例分給 Q1 和 Q2,即每條 Queue 4.5G。然而,以上這些分配都只會在 Congestion (壅塞) 發生時生效,平時這 10G 都是可共用的,又稱為 Share Mode。但需留意任何情況下 PQ 都有權先行,因此我們通常會把 Voice Traffic 放到 PQ,例如 CoS 5 和 DSCP 46。Bandwidth 分配是可設定的,方法如下。

SW(config)#mls qos srr-queue input priority-queue 2 bandwidth 20
SW(config)#mls qos srr-queue input bandwidth 40 60
SW(config)#end
SW#show mls qos input-queue
Queue     :       1       2
----------------------------------------------
buffers   :      80      20
bandwidth :      40      60
priority  :       0      20
threshold1:     100     100
threshold2:     100     100

假設 Switching Fabric 有 10G Bandwidth,透過以上設定 Scheduler 把 2G 先分配給 PQ (Q2),剩餘 8G 的 40% 即 3.2G 分配給 Q1,另外 60% 即 4.8G 則分配給 Q2。留意以上分配只在 Congestion 發生時作出才有效,如沒有 Congestion 時,10G Bandwidth 會招待所有 Queue。最後介紹一下,如有需要我們可以把 PQ 關掉,方法是把 PQ 的 Bandwidth 設成 0 便可。

SW(config)#mls qos srr-queue input priority-queue 2 bandwidth 0
SW(config)#end
SW#show mls qos input-queue
Queue     :       1       2
----------------------------------------------
buffers   :      90      10
bandwidth :      40      60
priority  :       0       0
threshold1:     100     100
threshold2:     100     100

Weighted Tail Drop

Queue 滿溢時才開始 Tail Drop 是不好的,較理想的方法是按 CoS 或 DSCP 把不重要的 Data Frame 提早 Drop 掉,保留空間給較重要的 Frame,稱為 Weighted Tail Drop (WTD)。每條 Queue 有 3 個 Threshold 值,即 Threshold 1、Threshold 2 和 Threshold 3,預設值為 100%。可用以下指令更改 Threshold 1 和 Threshold 2,而 Threshold 3 值 100% 則無法更改。

SW(config)#mls qos srr-queue input threshold 1 33 66
SW(config)#mls qos srr-queue input threshold 2 20 50
SW(config)#end
SW#show mls qos input-queue
Queue     :       1       2
----------------------------------------------
buffers   :      90      10
bandwidth :      40      60
priority  :       0       0
threshold1:      33      20
threshold2:      66      50

之前介紹過的 Cos-inputq-threshold Map 和 Dscp-inputq-threshold Map 中 Hyphen – 後面的數字就是 Threshold。我們可為不同 CoS 和 DSCP 值的 Frame 設定使用哪組 Threshold。以下例子設定 CoS 3 的 Frame 使用 Threshold 2,CoS 4 則使用 Threshold 3。

SW(config)#mls qos srr-queue input cos-map threshold 2 3
SW(config)#mls qos srr-queue input cos-map threshold 3 4
SW(config)#end
SW#show mls qos maps cos-input-q
   Cos-inputq-threshold map:
              cos:  0   1   2   3   4   5   6   7
              ------------------------------------
  queue-threshold: 1-1 1-1 1-1 1-2 1-3 2-1 2-1 2-1

意思是當 Q1 到達 Threshold 1 即 33% 滿時,新來的 Frame 如果是 CoS 0、1 和 2 就會被 Drop 掉。同樣道理,當 Q1 到達 Threshold 2 即 66% 滿時,新來的 Frame 如果是 CoS 0、1、2 和 3 都會被 Drop 掉。最後,如 Q1 達到 Threshold 3 即 100% 全滿,則 CoS 0 至 4 都會被 Drop 掉,CoS 5 至 7 不受影響的原因是它們被安排在 Q2。修改 dscp-map 的 threshold 值指令相若,不再重覆。

Ingress 與 Egress 的差異

現在大家應該了解 Ingress 那邊的架構和設定了,再來是探討一下 Switching Fabric 右邊的 Egress。由於 Egress 只有 Queuing 和 Scheduler,我們集中比較一下兩者在 Queuing 和 Scheduler 的差別。

  1. 所有 Incoming Interface 都使用同一組 Ingress Queue 和 Scheduler,但每個 Egress Interface 都使用自己獨立的 Queue 和 Scheduler。
  2. Ingress 只有兩條 Queue,而每組 Egress 都有 4 條 Queue。
  3. Ingress Queue 在 Globally Configuration Mode 設定,而 Egress Queue 則在 Interface Configuration Mode 中設定。
  4. Ingress Scheduler 只支緩 Share,而 Egress Scheduler 則支緩 Share、Shape 和 Limit,稍後說明。
  5. Egress Queue 用 Queue Set 的設定方法,即提供兩組設定去應用在不同的 Interface 上,稍後說明。

Egress

Egress 並不提供 Classification、Marking 及 Policing,因此我們直接跳進 Queuing。跟 Ingress 相似,Data Frame 從 Switching Fabric 出來後會跟據 Cos-outputq-threshold map 和 DSCP-outputq-threshold map 把 Data Frame 安排放入 Q1 至 Q4 之中。由於設定方法跟 Ingress 相似,不再重覆。

SW#show mls qos maps cos-output-q
   Cos-outputq-threshold map:
              cos:  0   1   2   3   4   5   6   7
              ------------------------------------
  queue-threshold: 2-1 2-1 3-1 3-1 4-1 1-1 4-1 4-1

SW#
SW#show mls qos maps dscp-output-q
   Dscp-outputq-threshold map:
     d1 :d2    0     1     2     3     4     5     6     7     8     9
     ------------------------------------------------------------
      0 :    02-01 02-01 02-01 02-01 02-01 02-01 02-01 02-01 02-01 02-01
      1 :    02-01 02-01 02-01 02-01 02-01 02-01 03-01 03-01 03-01 03-01
      2 :    03-01 03-01 03-01 03-01 03-01 03-01 03-01 03-01 03-01 03-01
      3 :    03-01 03-01 04-01 04-01 04-01 04-01 04-01 04-01 04-01 04-01
      4 :    01-01 01-01 01-01 01-01 01-01 01-01 01-01 01-01 04-01 04-01
      5 :    04-01 04-01 04-01 04-01 04-01 04-01 04-01 04-01 04-01 04-01
      6 :    04-01 04-01 04-01 04-01

Queue Set

跟 Ingress Queue 不同,每一個 Egress Interface 都擁有自己的 Queue Buffer,如要分別為每一個 Interface 進行設定太辛苦了!因此有了 Queue Set 的概念,先把 Queue Set 設定好 (最多只可設兩組 Queue Set),然後把 Queue Set 應用在 Interface 上。以下為兩組 Queue Set 的預設值。

SW#show mls qos queue-set 1
Queueset: 1
Queue     :       1       2       3       4
----------------------------------------------
buffers   :      25      25      25      25
threshold1:     100     200     100     100
threshold2:     100     200     100     100
reserved  :      50      50      50      50
maximum   :     400     400     400     400

SW#
SW#show mls qos queue-set 2
Queueset: 2
Queue     :       1       2       3       4
----------------------------------------------
buffers   :      25      25      25      25
threshold1:     100     200     100     100
threshold2:     100     200     100     100
reserved  :      50      50      50      50
maximum   :     400     400     400     400

以 Queue Set 1 為例子,假設 Interface 上的 Buffer 總量為 x,每條 Queue 便會得到 (25%x) 的 Buffer,稱為 Allocated Buffer。而在這 (25%x) 的 Allocated Buffer 之中保留 (reserved) 了 50% 即 (12.5%x) 的 Buffer,稱為 Reserved Buffer,是保證留給該 Queue 使用的,而剩餘的 (12.5%x) 則可在空閒時借給其他 Queue 使用。至於 Threshold 1、Threshold 2 和 Maximum 則是 Weighted Tail Drop 設定,以 Q1 為例,Threshold 1 和 Threshold 2 的設定是 Reserved Buffer 的 100%,即是 12.5%x,而 Threshold 3 則等於 Reserved Buffer 的 400% 即 50%x。只看數字超複雜的,請看下圖:

qos-switch

Cisco 文獻聲稱,預設 Queue Set 已適合大部份網絡環境,不用更改。如堅持更改,可用以下指令。

SW(config)#mls qos queue-set output 1 buffers 30 30 20 20
SW(config)#mls qos queue-set output 1 threshold 1 200 400 75 800
SW(config)#end
SW#show mls qos queue-set 1
Queueset: 1
Queue     :       1       2       3       4
----------------------------------------------
buffers   :      30      30      20      20
threshold1:     200     200     100     100
threshold2:     400     200     100     100
reserved  :      75      50      50      50
maximum   :     800     400     400     400

Switch 預設把 Queue Set 1 應用到所有 Interface。

SW#show mls qos interface fastEthernet 1/0/13 queueing
FastEthernet1/0/13
Egress Priority Queue : disabled
Shaped queue weights (absolute) :  10 20 30 40
Shared queue weights  :  25 25 25 25
The port bandwidth limit : 100  (Operational Bandwidth:100.0)
The port is mapped to qset : 1

如需更改可使用以下指令。

SW(config-if)#queue-set 2
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13 queueing
FastEthernet1/0/13
Egress Priority Queue : disabled
Shaped queue weights (absolute) :  10 20 30 40
Shared queue weights  :  25 25 25 25
The port bandwidth limit : 100  (Operational Bandwidth:100.0)
The port is mapped to qset : 2

至於 Cos-outputq-threshold map 和 DSCP-outputq-threshold map 的 Threshold 設定,跟 Ingress 相似,不再重覆。

Share、Shape 與 Limit

Ingress Scheduler 把 Frame 送上 Switching Fabric 只支緩 Share,當我們為 Queue 設定好 Bandwidth 比例後,只有在 Congestion 發生時才會按比例配置 Bandwidth。Egress Scheduler 把 Frame 送上 Outgoing Interface 一樣支緩 Share。不同的是 Egress Scheduler 是按每一個 Interface 獨立設定的,指令如下:

SW(config-if)#srr-queue bandwidth share 1 1 2 3
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13 queueing
FastEthernet1/0/13
Egress Priority Queue : disabled
Shaped queue weights (absolute) :  10 20 30 40
Shared queue weights  :  1 1 2 3
The port bandwidth limit : 100  (Operational Bandwidth:100.0)
The port is mapped to qset : 2

於是,Scheduler 會按 1:1:2:3 的比例把 Outgoing Interface 的 Bandwidth 分配給 Queue 1、2、3 和 4。

Egress Scheduler 額外支緩 Shape,當一條 Queue 加了 Shape 設定代表其分配到的 Bandwidth 設了上限,無論有沒有 Congestion 發生也不能超過這上限。

SW(config-if)#srr-queue bandwidth shape 10 20 0 0
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13 queueing
FastEthernet1/0/13
Egress Priority Queue : disabled
Shaped queue weights (absolute) :  10 20 0 0
Shared queue weights  :  1 1 2 3
The port bandwidth limit : 100  (Operational Bandwidth:100.0)
The port is mapped to qset : 2

這樣設定的意思是,Q1 最多只得到 Outgoing Interface 的 1/10 Bandwidth 即 10%,而 Q2 則最多得到 1/20 即 5%,如設成 0 則表示不設限制。

至於 Limit 則比較簡單,只是為 Scheduler 設定其最大傳輸量,以下例子設 Limit 85 的意思是 Scheduler 只會應用 Outgoing Interface 的 85% Bandwidth。以 FastEthernet (100M) 為例就只用 85M。

SW(config-if)#srr-queue bandwidth limit 85
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13 queueing
FastEthernet1/0/13
Egress Priority Queue : disabled
Shaped queue weights (absolute) :  10 20 0 0
Shared queue weights  :  1 1 2 3
The port bandwidth limit : 85  (Operational Bandwidth:85.05)
The port is mapped to qset : 2

Priority Queue

Egress 也可設 Priority Queue,但必需為 Q1 不能選其他。把 Q1 設成 PQ 後,Scheduler 總是先處理 Q1,直至 Q1 被清空才處理其他 Queue。

SW(config-if)#priority-queue out
SW(config-if)#end
SW#show mls qos interface fastEthernet 1/0/13 queueing
FastEthernet1/0/13
Egress Priority Queue : enabled
Shaped queue weights (absolute) :  10 20 0 0
Shared queue weights  :  1 1 2 3
The port bandwidth limit : 85  (Operational Bandwidth:85.05)
The port is mapped to qset : 2

相關主題

發佈留言

2018-06-24

Posted In: menu-tall-2-zh-hant, 網絡服務 Services

Leave a Comment