本文档介绍如何实施适用于基于多协议标签交换(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)路由器功能的Cisco 3660或7206。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
有关文件规则的更多信息请参见“ Cisco技术提示规则”。
下图描述了当数据包通过MPLS核心从一个客户边缘(CE)路由器传输到另一个CE路由器时,DiffServ代码点(DSCP)/MPLS实验(EXP)位的默认行为:
本节的其余部分介绍默认行为图中的练习。
标签的实施(IP ->标签):
传入IP数据包的IP优先级将复制到所有推送标签的MPLS EXP位。
DSCP位的前3位将复制到所有推送标签的MPLS EXP位。
此技术也称为ToS反射。
MPLS转发(标签 — >标签):
EXP将复制到转发或实施期间交换/推送的新标签。
在标签实施时,不修改基础标签,而将新标签的值添加到当前标签堆栈。
在标签处置时,EXP位不会下复制到新暴露的标签EXP位。
标签处置(标签 — > IP):
在标签处置时,EXP位不会下复制到新暴露的IP数据包的IP优先级/DSCP字段。
在IOS版本12.2(13)T之前,set mpls实验命令是唯一可用于修改MPLS EXP位的方法。
对于IOS版本12.2(13)T及更高版本,将修改set mpls experimental命令以允许以下选项:
设置mpls experimental topmost {mpls-exp-value | qos-group [table table-map-name]}
set mpls experimental imposition {mpls-exp-value | qos-group [table table-map-name]}
注意:新的set mpls experimental topmost命令等同于旧的set mpls impsition命令。
这两个命令与一些新命令交换机相结合,可以更好地控制标签推送、交换和弹出操作期间的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路由器以通告显式空标签。在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分开。此每核QoS PHB对最终用户保持透明。
当数据包到达MPLS核心的边缘时,出口PE路由器(PE2)根据MPLS PHB从最近删除的标签的EXP位中对新暴露的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 PHB从此IP数据包的DSCP值对新暴露的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预先/差分服务复制到MPLS EXP中(SP也可以更改) | MPLS EXP可能由SP更改 | MPLS EXP复制到IP预测/区分服务 |
管道 | 由SP QoS策略设置的MPLS EXP | 保留原始IP Prec/Diffserv(基于MPLS EXP的出口队列) | |
短管 | 保留原始IP Prec/Diffserv(基于IP Prec/DiffServ的出口队列) |