本檔案介紹適用於基於多協定標籤交換(MPLS)網路環境的差異化服務(DiffServ)通道模式的實作。
本文檔的讀者應瞭解以下主題:
適用於虛擬私人網路(VPN)的MPLS和MPLS
與IP優先順序、服務型別(ToS)和DiffServ相關的概念
使用模組化QoS指令行介面CLI(MQC)的服務品質(QoS)封包標籤和分類
本文中的資訊係根據以下軟體和硬體版本:
Cisco IOS軟體®版本12.2(13)T,用於新的QoS功能。版本12.1(5)T包括原始QoS功能。
3600系列或更高版本中的任何思科路由器,例如支援MPLS提供商核心(P)路由器/提供商邊緣(PE)路由器功能的思科3660或7206。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
此圖說明當封包透過MPLS核心從一個客戶邊緣(CE)路由器傳送到另一個CE路由器時,DiffServ程式碼點(DSCP)/MPLS試驗(EXP)位元的預設行為:
本節的其餘部分將描述預設行為圖中的活動。
強加標籤(IP ->標籤):
傳入IP封包的IP優先順序會複製到所有已推送標籤的MPLS EXP位元中。
DSCP位的第三個位被複製到所有推送標籤的MPLS EXP位。
這種技術也稱為ToS反射。
MPLS轉發(標籤 — >標籤):
將EXP複製到轉發或強制實施期間交換/推送的新標籤。
在設定標籤時,不會修改基礎標籤並將新標籤的值新增到當前標籤堆疊中。
在標籤配置中,EXP位不會複製到新暴露的標籤EXP位。
標籤(標籤 — > IP)性質:
在標籤配置時,EXP位不會複製到新暴露的IP資料包的IP優先順序/DSCP欄位。
在IOS版本12.2(13)T之前,set mpls experimental 命令是可用於修改MPLS EXP位元的唯一方法。
在IOS版本12.2(13)T和更新版本中,將set mpls experimental命令修改為允許以下選項:
set mpls experimental top {mpls-exp-value | qos-group [table table-map-name]}
set mpls experimental implementation {mpls-exp-value | qos-group [table table-map-name]}
注意:新的set mpls experimental top命令等效於舊的set mpls pementation命令。
這兩個命令與一些新的命令交換機相結合,可以在標籤推送、交換和pop操作期間更好地控制MPLS EXP位操作。這兩個命令允許您使用DiffServ隧道模式。
Diffserv通道模式引入了新的每躍點行為(PHB),允許提供商網路中的差異QoS。隧道模式在網路邊緣定義,通常在PE標籤交換機路由器(LSR)中(入口和出口)。 您可能需要在P路由器上進行更改;還必須考慮由於Penultimate-Hop-Popping(PHP)而從資料包中刪除最頂端的標籤時會發生的情況。 可能需要將MPLS EXP值從正被彈出的頂部標籤複製到新暴露的標籤;這並不總是適用於所有通道模式。
在某些情況下(例如,純非VPN MPLS網路),當接收到只有一個標籤的資料包時,最終P路由器上的PHP操作可能會暴露一個純IP資料包。當輸出LSR(PE)收到此IP封包時,無法根據MPLS EXP位元對封包進行分類,因為現在沒有標籤。在這些情況下,您必須配置輸出PE路由器以通告顯性null標簽。當在P路由器上執行PHP操作時,將傳送一個值為零的標籤,使用此特殊標籤可以將EXP位標籤為正常標籤的資料包,從而允許在出口PE路由器上進行正確的分類。
Diffserv規範的MPLS網路支援定義了以下隧道模式:
下一節將分別檢查每個隧道模式,並提供示例來說明如何配置每個隧道模式。示例包括IP優先順序到MPLS EXP位的完整對映。每個客戶可以有多個不同的QoS引數和隧道模式。
注意:這些配置示例不是特定於MPLS VPN,適用於普通MPLS網路和運營商支援的運營商(CsC)網路。您的網路也可能與另一個網路不同 — 可以使用許多不同的QoS引數和隧道模式。
DiffServ通道統一模式只有一層到達端到端的QoS。輸入PE路由器(PE1)將DSCP從傳入IP資料包複製到強加標籤的MPLS EXP位。由於EXP位經過核心,它們可能由中繼P路由器修改,也可能不修改。在本例中,P路由器P1修改頂標籤的EXP位。在輸出P路由器(P2)上,我們將EXP位複製到PHP(Penultimate-Hop-Pop)之後新公開標籤的EXP位中。 最後,在輸出PE路由器(PE2)處,我們將EXP位複製到新暴露的IP資料包的DSCP位。
統一模式配置:
PE1 |
---|
!--- This configuration maps the IP Precedence !--- of the incoming IP packets to the MPLS EXP bits. class-map match-all IP-AF11 match ip precedence 0 class-map match-all IP-AF12 match ip precedence 1 class-map match-all IP-AF21 match ip precedence 2 class-map match-all IP-AF22 match ip precedence 3 class-map match-all IP-AF31 match ip precedence 4 class-map match-all IP-AF32 match ip precedence 5 class-map match-all MPLS-AF11 match mpls experimental topmost 0 class-map match-all MPLS-AF12 match mpls experimental topmost 1 class-map match-all MPLS-AF21 match mpls experimental topmost 2 class-map match-all MPLS-AF22 match mpls experimental topmost 3 class-map match-all MPLS-AF31 match mpls experimental topmost 4 class-map match-all MPLS-AF32 match mpls experimental topmost 5 policy-map set-MPLS-PHB class IP-AF11 police 8000 conform-action set-mpls-exp-imposition-transmit 0 exceed-action drop class IP-AF12 police 10000 conform-action set-mpls-exp-imposition-transmit 1 exceed-action set-mpls-exp-imposition-transmit 0 class IP-AF21 police 12000 conform-action set-mpls-exp-imposition-transmit 2 exceed-action set-mpls-exp-imposition-transmit 1 class IP-AF22 police 12000 conform-action set-mpls-exp-imposition-transmit 3 exceed-action set-mpls-exp-imposition-transmit 2 class IP-AF31 police 12000 conform-action set-mpls-exp-imposition-transmit 4 exceed-action set-mpls-exp-imposition-transmit 3 class IP-AF32 police 12000 conform-action set-mpls-exp-imposition-transmit 5 exceed-action set-mpls-exp-imposition-transmit 4 policy-map output-qos class MPLS-AF11 bandwidth percent 5 random-detect class MPLS-AF12 bandwidth percent 10 random-detect class MPLS-AF21 bandwidth percent 10 random-detect class MPLS-AF22 bandwidth percent 15 random-detect class MPLS-AF31 bandwidth percent 20 random-detect class MPLS-AF32 bandwidth percent 30 random-detect interface Ethernet0/0 ip address 192.168.0.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output output-qos tag-switching ip ! interface Ethernet1/0 ip vrf forwarding v1 ip address 10.0.0.2 255.255.255.0 service-policy input set-MPLS-PHB ! |
P1 |
---|
!--- This configuration swaps the top label from 3 to 2, !--- which does not need to occur to follow the previous configuration. class-map match-all mpls-in match mpls experimental topmost 3 ! policy-map mpls-in class mpls-in set mpls experimental topmost 2 ! interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 tag-switching ip ! interface Ethernet1/0 ip address 192.168.0.2 255.255.255.0 service-policy input mpls-in tag-switching ip ! |
P2 |
---|
!--- Remember to copy down the MPLS EXP value !--- from the newly exposed label after the PHP. class-map match-all MPLS-AF11 match mpls experimental topmost 0 class-map match-all MPLS-AF12 match mpls experimental topmost 1 class-map match-all MPLS-AF21 match mpls experimental topmost 2 class-map match-all MPLS-AF22 match mpls experimental topmost 3 class-map match-all MPLS-AF31 match mpls experimental topmost 4 class-map match-all MPLS-AF32 match mpls experimental topmost 5 ! class-map match-all qos-group-AF11 match qos-group 0 class-map match-all qos-group-AF12 match qos-group 1 class-map match-all qos-group-AF21 match qos-group 2 class-map match-all qos-group-AF22 match qos-group 3 class-map match-all qos-group-AF31 match qos-group 4 class-map match-all qos-group-AF32 match qos-group 5 ! policy-map qos-group-in class MPLS-AF11 set qos-group mpls experimental topmost class MPLS-AF12 set qos-group mpls experimental topmost class MPLS-AF21 set qos-group mpls experimental topmost class MPLS-AF22 set qos-group mpls experimental topmost class MPLS-AF31 set qos-group mpls experimental topmost class MPLS-AF32 set qos-group mpls experimental topmost ! policy-map qos-group-out class qos-group-AF11 bandwidth percent 5 random-detect set mpls experimental topmost qos-group class qos-group-AF12 bandwidth percent 10 random-detect set mpls experimental topmost qos-group class qos-group-AF21 bandwidth percent 10 random-detect set mpls experimental topmost qos-group class qos-group-AF22 bandwidth percent 15 random-detect set mpls experimental topmost qos-group class qos-group-AF31 bandwidth percent 20 random-detect set mpls experimental topmost qos-group class qos-group-AF32 bandwidth percent 30 random-detect set mpls experimental topmost qos-group ! interface Ethernet0/0 ip address 192.168.2.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output qos-group-out tag-switching ip ! interface Ethernet1/0 ip address 192.168.1.2 255.255.255.0 service-policy input qos-group-in tag-switching ip ! |
PE2 |
---|
!--- Remember to copy down the MPLS EXP bits to the IP Precedence !--- of the newly exposed IP packet. class-map match-all MPLS-AF11 match mpls experimental topmost 0 class-map match-all MPLS-AF12 match mpls experimental topmost 1 class-map match-all MPLS-AF21 match mpls experimental topmost 2 class-map match-all MPLS-AF22 match mpls experimental topmost 3 class-map match-all MPLS-AF31 match mpls experimental topmost 4 class-map match-all MPLS-AF32 match mpls experimental topmost 5 ! class-map match-all qos-group-AF11 match qos-group 0 class-map match-all qos-group-AF12 match qos-group 1 class-map match-all qos-group-AF21 match qos-group 2 class-map match-all qos-group-AF22 match qos-group 3 class-map match-all qos-group-AF31 match qos-group 4 class-map match-all qos-group-AF32 match qos-group 5 ! policy-map qos-group-in class MPLS-AF11 set qos-group mpls experimental topmost class MPLS-AF12 set qos-group mpls experimental topmost class MPLS-AF21 set qos-group mpls experimental topmost class MPLS-AF22 set qos-group mpls experimental topmost class MPLS-AF31 set qos-group mpls experimental topmost class MPLS-AF32 set qos-group mpls experimental topmost ! policy-map qos-group-out class qos-group-AF11 bandwidth percent 5 random-detect set precedence qos-group class qos-group-AF12 bandwidth percent 10 random-detect set precedence qos-group class qos-group-AF21 bandwidth percent 10 random-detect set precedence qos-group class qos-group-AF22 bandwidth percent 15 random-detect set precedence qos-group class qos-group-AF31 bandwidth percent 20 random-detect set precedence qos-group class qos-group-AF32 bandwidth percent 30 random-detect set precedence qos-group ! interface Ethernet0/0 ip vrf forwarding v1 ip address 10.0.1.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output qos-group-out ! interface Ethernet1/0 ip address 192.168.2.2 255.255.255.0 service-policy input qos-group-in tag-switching ip ! |
Diffserv通道管道模式使用兩層QoS:
資料的底層QoS,在遍歷核心時保持不變。
每核心QoS,與基礎IP資料包的分隔。此按核心QoS PHB對終端使用者保持透明。
當資料包到達MPLS核心的邊緣時,輸出PE路由器(PE2)基於來自最近移除標籤的EXP位的MPLS PHB對新暴露的IP資料包進行出站隊列分類。
管道模式配置:
PE1 |
---|
!--- On input, the IP Precedence is copied to the MPLS EXP !--- on label imposition and when leaving the router, the !--- MPLS EXP bits are used to classify the traffic into three !--- traffic classes—gold, silver, and bronze (the topmost). class-map match-all IP-AF22 match ip precedence 0 1 class-map match-all IP-AF31 match ip precedence 2 3 class-map match-all IP-AF32 match ip precedence 4 5 ! class-map match-all bronze match mpls experimental topmost 2 3 class-map match-all silver match mpls experimental topmost 4 class-map match-all gold match mpls experimental topmost 5 ! policy-map set-MPLS-PHB class IP-AF22 police 12000 conform-action set-mpls-exp-imposition-transmit 3 exceed-action set-mpls-exp-imposition-transmit 2 class IP-AF31 police 12000 conform-action set-mpls-exp-imposition-transmit 4 exceed-action set-mpls-exp-imposition-transmit 3 class IP-AF32 police 12000 conform-action set-mpls-exp-imposition-transmit 5 exceed-action set-mpls-exp-imposition-transmit 4 ! policy-map output-qos class gold bandwidth 40 random-detect class silver bandwidth 30 random-detect class bronze bandwidth 20 random-detect ! interface Ethernet0/0 ip address 192.168.0.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output output-qos tag-switching ip ! interface Ethernet1/0 ip vrf forwarding v1 ip address 10.0.0.2 255.255.255.0 service-policy input set-MPLS-PHB ! |
P1 |
---|
!--- This configuration swaps the top label from 4 to 5, !--- which does not need to occur to follow the previous configuration. class-map match-all mpls-in match mpls experimental topmost 4 ! policy-map mpls-in class mpls-in set mpls experimental topmost 5 ! interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 tag-switching ip ! interface Ethernet1/0 ip address 192.168.0.2 255.255.255.0 service-policy input mpls-in tag-switching ip ! |
P2 |
---|
!--- Remember to copy down the MPLS EXP value from !--- the newly exposed label after the PHP. class-map match-all MPLS-AF11 match mpls experimental topmost 0 class-map match-all MPLS-AF12 match mpls experimental topmost 1 class-map match-all MPLS-AF21 match mpls experimental topmost 2 class-map match-all MPLS-AF22 match mpls experimental topmost 3 class-map match-all MPLS-AF31 match mpls experimental topmost 4 class-map match-all MPLS-AF32 match mpls experimental topmost 5 ! class-map match-all gold match qos-group 5 class-map match-all silver match qos-group 4 class-map match-all bronze match qos-group 3 match qos-group 2 ! policy-map qos-group-in class MPLS-AF11 set qos-group mpls experimental topmost class MPLS-AF12 set qos-group mpls experimental topmost class MPLS-AF21 set qos-group mpls experimental topmost class MPLS-AF22 set qos-group mpls experimental topmost class MPLS-AF31 set qos-group mpls experimental topmost class MPLS-AF32 set qos-group mpls experimental topmost ! policy-map qos-group-out class gold bandwidth 40 random-detect set mpls experimental topmost qos-group class silver bandwidth 30 random-detect set mpls experimental topmost qos-group class bronze bandwidth 20 random-detect set mpls experimental topmost qos-group ! interface Ethernet0/0 ip address 192.168.2.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output qos-group-out tag-switching ip ! interface Ethernet1/0 ip address 192.168.1.2 255.255.255.0 service-policy input qos-group-in tag-switching ip ! |
PE2 |
---|
!--- Remember to queue the newly exposed IP packet based in !--- the MPLS EXP bits of the label we just removed. Use !--- qos-groups to keep track of this value. class-map match-all MPLS-AF11 match mpls experimental topmost 0 class-map match-all MPLS-AF12 match mpls experimental topmost 1 class-map match-all MPLS-AF21 match mpls experimental topmost 2 class-map match-all MPLS-AF22 match mpls experimental topmost 3 class-map match-all MPLS-AF31 match mpls experimental topmost 4 class-map match-all MPLS-AF32 match mpls experimental topmost 5 ! class-map match-all gold match qos-group 5 class-map match-all silver match qos-group 4 class-map match-all bronze match qos-group 3 match qos-group 2 ! policy-map qos-group-in class MPLS-AF11 set qos-group mpls experimental topmost set discard-class 0 class MPLS-AF12 set qos-group mpls experimental topmost set discard-class 1 class MPLS-AF21 set qos-group mpls experimental topmost set discard-class 2 class MPLS-AF22 set qos-group mpls experimental topmost set discard-class 3 class MPLS-AF31 set qos-group mpls experimental topmost set discard-class 4 class MPLS-AF32 set qos-group mpls experimental topmost set discard-class 5 ! policy-map qos-group-out class gold bandwidth 40 random-detect discard-class-based class silver bandwidth 30 random-detect discard-class-based class bronze bandwidth 20 random-detect discard-class-based ! interface Ethernet0/0 ip vrf forwarding v1 ip address 10.0.1.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output qos-group-out ! interface Ethernet1/0 ip address 192.168.2.2 255.255.255.0 service-policy input qos-group-in tag-switching ip ! |
Diffserv隧道短管道模式在核心中使用相同的規則和技術。區別在於輸出PE路由器(PE2) — 您根據此IP資料包的DSCP值中的IP PHB對新公開的IP資料包進行出站隊列分類。
短管道模式配置:
PE1 |
---|
!--- On input, the IP Precedent is copied to the MPLS EXP !--- on label imposition. When leaving the router, the !--- MPLS EXP bits are used to classify the traffic into three !--- traffic classes—gold, silver and bronze (the topmost). class-map match-all IP-AF22 match ip precedence 0 1 class-map match-all IP-AF31 match ip precedence 2 3 class-map match-all IP-AF32 match ip precedence 4 5 ! class-map match-all bronze match mpls experimental topmost 2 3 class-map match-all silver match mpls experimental topmost 4 class-map match-all gold match mpls experimental topmost 5 ! policy-map set-MPLS-PHB class IP-AF22 police 12000 conform-action set-mpls-exp-imposition-transmit 3 exceed-action set-mpls-exp-imposition-transmit 2 class IP-AF31 police 12000 conform-action set-mpls-exp-imposition-transmit 4 exceed-action set-mpls-exp-imposition-transmit 3 class IP-AF32 police 12000 conform-action set-mpls-exp-imposition-transmit 5 exceed-action set-mpls-exp-imposition-transmit 4 ! policy-map output-qos class gold bandwidth 40 random-detect class silver bandwidth 30 random-detect class bronze bandwidth 20 random-detect ! interface Ethernet0/0 ip address 192.168.0.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output output-qos tag-switching ip ! interface Ethernet1/0 ip vrf forwarding v1 ip address 10.0.0.2 255.255.255.0 service-policy input set-MPLS-PHB ! |
P1 |
---|
!--- This configuration swaps the top label from 4 to 5, !--- which does not need to occur to follow the previous configuration. class-map match-all mpls-in match mpls experimental topmost 4 ! policy-map mpls-in class mpls-in set mpls experimental topmost 5 ! interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 tag-switching ip ! interface Ethernet1/0 ip address 192.168.0.2 255.255.255.0 service-policy input mpls-in tag-switching ip ! |
P2 |
---|
!--- Remember to copy down the MPLS EXP value from !--- the newly exposed label after the PHP. class-map match-all MPLS-AF11 match mpls experimental topmost 0 class-map match-all MPLS-AF12 match mpls experimental topmost 1 class-map match-all MPLS-AF21 match mpls experimental topmost 2 class-map match-all MPLS-AF22 match mpls experimental topmost 3 class-map match-all MPLS-AF31 match mpls experimental topmost 4 class-map match-all MPLS-AF32 match mpls experimental topmost 5 ! class-map match-all gold match qos-group 5 class-map match-all silver match qos-group 4 class-map match-all bronze match qos-group 3 match qos-group 2 ! policy-map qos-group-in class MPLS-AF11 set qos-group mpls experimental topmost class MPLS-AF12 set qos-group mpls experimental topmost class MPLS-AF21 set qos-group mpls experimental topmost class MPLS-AF22 set qos-group mpls experimental topmost class MPLS-AF31 set qos-group mpls experimental topmost class MPLS-AF32 set qos-group mpls experimental topmost ! policy-map qos-group-out class gold bandwidth 40 random-detect set mpls experimental topmost qos-group class silver bandwidth 30 random-detect set mpls experimental topmost qos-group class bronze bandwidth 20 random-detect set mpls experimental topmost qos-group ! interface Ethernet0/0 ip address 192.168.2.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output qos-group-out tag-switching ip ! interface Ethernet1/0 ip address 192.168.1.2 255.255.255.0 service-policy input qos-group-in tag-switching ip ! |
PE2 |
---|
!--- Remember to queue the newly exposed IP packet !--- based on the value of the IP Precedent. class-map match-all gold match precedence 4 5 class-map match-all silver match precedence 2 3 class-map match-all bronze match precedence 0 1 ! policy-map qos-group-out class gold bandwidth 40 random-detect prec-based class silver bandwidth 30 random-detect prec-based class bronze bandwidth 20 random-detect prec-based ! interface Ethernet0/0 ip vrf forwarding v1 ip address 10.0.1.1 255.255.255.0 max-reserved-bandwidth 90 service-policy output qos-group-out ! interface Ethernet1/0 ip address 192.168.2.2 255.255.255.0 tag-switching ip ! |
下表總結了應用於網路中不同階段的IP或標籤資料包的各種操作:
通道模式 | IP ->標籤 | 標籤 — >標籤 | 標籤 — > IP |
---|---|---|---|
統一 | 將IP Prec/DiffServ複製到MPLS EXP(也可由SP更改) | SP可能更改MPLS EXP | 將MPLS EXP複製到IP Prec/DiffServ |
管道 | 由SP QoS策略設定的MPLS EXP | 保留原始IP Prec/Diffserv(基於MPLS EXP的出口隊列) | |
短管道 | 保留原始IP Prec/Diffserv(在IP Prec/DiffServ中基於輸出佇列) |