Sub topic 9
MPLS QoS classes and traffic engineering
This chapter assumes you know the push, swap, and pop operations from the label switching chapter and how an MPLS Layer 3 VPN carries customer routes. You should also be able to read a Cisco IOS interface configuration and know what DSCP is. MPLS gives a provider two more tools beyond forwarding. QoS classes decide which packets get better treatment when a link is busy. Traffic engineering decides which path traffic takes, instead of always using the IGP shortest path.
Where the QoS marking lives
An MPLS label stack entry is 32 bits long:
| Field | Size | Purpose |
|---|---|---|
| Label | 20 bits | Identifies the forwarding equivalence class |
| TC (Traffic Class) | 3 bits | Carries the QoS class |
| S | 1 bit | Marks the bottom of the label stack |
| TTL | 8 bits | Limits loops |
The TC field was originally called EXP (experimental). Many CLIs still use that name. Three bits give eight values, so an MPLS core can distinguish at most eight classes.
A core router (a P router) does not look inside the packet. It cannot read the customer's DSCP, which is a 6-bit IP header field. It reads only the TC bits of the top label. Marking therefore has to be copied from the IP header into the label at the edge.
Mapping DSCP to TC at the provider edge
The usual DiffServ design for MPLS works in three steps:
- The CE router (or the provider) marks traffic with DSCP values.
- The ingress PE classifies each packet, optionally polices it against the contracted rate for that class, and sets the TC bits on the labels it pushes.
- Every P router queues and drops packets according to TC, using per-class queues.
The provider typically sells three to six classes. A common layout:
| Class | Typical DSCP | TC | Queueing behavior |
|---|---|---|---|
| Real-time (voice) | EF (46) | 5 | Strict priority queue, policed |
| Interactive video | AF41 | 4 | Guaranteed bandwidth |
| Critical data | AF31 | 3 | Guaranteed bandwidth, WRED |
| Best effort | 0 | 0 | Remaining bandwidth |
Policing at ingress matters. If a customer sends more voice than the contract allows, the excess must be dropped or remarked to a lower class. Otherwise one customer's priority traffic could starve other customers sharing the same core links.
class-map match-any VOICE
match dscp ef
class-map match-any CRITICAL
match dscp af31
!
policy-map CUST-A-IN
class VOICE
police cir 2000000 conform-action set-mpls-exp-imposition-transmit 5 exceed-action drop
class CRITICAL
set mpls experimental imposition 3
!
interface GigabitEthernet0/2
service-policy input CUST-A-IN
!
class-map match-any CORE-VOICE
match mpls experimental topmost 5
!
policy-map CORE-OUT
class CORE-VOICE
priority percent 20
class class-default
fair-queue
!
interface GigabitEthernet0/1
service-policy output CORE-OUTThe first policy runs on the customer-facing PE interface and sets the TC bits as labels are imposed. The second policy runs on a core-facing interface and matches mpls experimental topmost, which reads the TC of the outermost label.
E-LSP, L-LSP, and the tunnel modes
TC has only 3 bits, so how the network uses it is a design choice:
- E-LSP: the TC bits tell the router both the queue and the drop precedence. One LSP carries up to eight classes. This is what nearly all deployments use.
- L-LSP: the label itself tells the router the class, and TC carries only drop precedence. It needs more labels and is rarely deployed.
An MPLS VPN packet carries at least two labels, a transport label and a VPN label. A provider may also want to hide customer markings from the core. DiffServ tunneling modes control that:
| Mode | What the core uses | What the egress PE does to the customer's DSCP |
|---|---|---|
| Uniform | Customer's marking, copied to TC | Rewritten from the final TC value, so core remarking is visible to the customer |
| Pipe | Provider's TC, set independently | Customer DSCP is unchanged, but the egress PE schedules by the provider's TC |
| Short-pipe | Provider's TC, set independently | Customer DSCP is unchanged, and the egress PE schedules by the customer's DSCP |
Most managed VPN services use short-pipe or pipe. The customer's DSCP survives the trip unchanged, so the customer's own QoS policy still works at the remote site.
Why the shortest path is not always the best path
The IGP (OSPF or IS-IS) builds label-switched paths along the lowest-cost route. LDP follows the same route. This causes a familiar problem. Suppose two paths exist between a pair of PEs, and the shorter one is used by all traffic:
- The shorter path can run at 95% utilization and drop packets.
- The longer path sits idle.
- Raising the IGP cost on one link shifts traffic, but it does so for every flow that uses that link, and it can create new congestion elsewhere.
Traffic engineering (TE) solves this by building LSPs along paths chosen by something other than lowest cost.
Mermaid diagram below.
How MPLS TE works
MPLS TE uses four building blocks:
- IGP extensions. OSPF or IS-IS floods extra link attributes: maximum bandwidth, reservable bandwidth, and administrative group colors. Every router builds a TE database from them.
- Constraint-based path calculation (CSPF). The head-end router runs shortest-path-first on the TE database after removing links that cannot meet the tunnel's constraints, such as 50 Mbps of bandwidth.
- RSVP-TE signaling. The head-end signals the chosen path hop by hop. Each router checks that bandwidth is available, reserves it, and assigns a label. This is how the LSP is built, in place of LDP.
- Traffic steering. Traffic must be directed into the tunnel. Options are a static route, policy routing, or
autoroute announce, which makes the IGP treat the tunnel as a next hop.
The head-end can use an explicit path (a list of hops you specify), a dynamic path (CSPF chooses), or both with priorities.
router ospf 1
mpls traffic-eng router-id Loopback0
mpls traffic-eng area 0
!
mpls traffic-eng tunnels
!
interface GigabitEthernet0/1
mpls traffic-eng tunnels
ip rsvp bandwidth 100000
!
ip explicit-path name VIA-NORTH enable
next-address 10.0.1.2
next-address 10.0.2.2
!
interface Tunnel1
ip unnumbered Loopback0
tunnel destination 10.255.255.2
tunnel mode mpls traffic-eng
tunnel mpls traffic-eng bandwidth 50000
tunnel mpls traffic-eng path-option 1 explicit name VIA-NORTH
tunnel mpls traffic-eng path-option 2 dynamic
tunnel mpls traffic-eng autoroute announceIf the explicit path fails or lacks bandwidth, the router tries path-option 2. Bandwidth values are in kbps. This tunnel asks for 50 Mbps.
Fast reroute and other TE features
TE also improves resilience. Fast reroute (FRR) pre-signals a backup tunnel around a protected link or node. If the link fails, the router that detects the failure switches traffic to the backup within about 50 ms, before the IGP has reconverged. The IGP alone usually takes much longer.
Other common features are auto-bandwidth, where the tunnel resizes itself based on measured traffic, and affinity, where links get colors and a tunnel is told to include or avoid certain colors.
Common errors and limits
- TE reservations are bookkeeping, not enforcement. RSVP reserves bandwidth in the control plane. Nothing stops actual traffic from exceeding it unless you also configure QoS.
- TE and DiffServ are separate. A tunnel with reserved bandwidth does not give voice priority. You still need the TC-based queues.
- Missing IGP TE extensions. If
mpls traffic-eng areais absent, tunnels stay down because the head-end finds no TE database path. - Forgetting traffic steering. A tunnel that comes up but carries no traffic usually lacks autoroute or a static route.
- Scale. Full-mesh TE between many PEs needs n(n-1) tunnels, and the signaling state grows quickly. Many providers use TE only on selected core paths.
- Customers do not get these. QoS and TE are provider-core features. A customer who buys MPLS VPN service sees only the classes in the service contract.
Exercise
A customer's voice packets arrive at the ingress PE with DSCP EF. The provider's P routers queue by TC. (a) Where does the DSCP-to-TC mapping happen? (b) The provider wants the customer's DSCP to arrive unchanged at the remote site. Which tunneling mode fits, and does the core need to read the DSCP?
Show answer
(a) At the ingress PE, which sets the TC bits when it pushes the labels. P routers read only the TC of the top label. (b) Pipe or short-pipe mode. The core never reads the DSCP, because it queues by TC. The IP header is untouched, so the customer's DSCP arrives unchanged.
Exercise
A TE tunnel shows as up with 50 Mbps reserved, but all traffic from PE1 to PE2 still takes the IGP shortest path. Name the likely cause and one fix.
Show answer
Nothing steers traffic into the tunnel. The IGP still sees the normal link as the best next hop. Add tunnel mpls traffic-eng autoroute announce on the tunnel, or add a static route pointing at Tunnel1.