Course contents

Unit 5: QoS and AppQoELesson 5.1 (1 of 7 in this unit)22 of 63 in the Advanced Cisco SD-WAN course

QoS architecture and DSCP mapping

How a DSCP mark travels from the endpoint through the edge, the tunnel and the provider: the codepoint arithmetic, mapping onto a provider's shorter class list, re-marking, and a worked case where video fell into best effort.

Advanced · 15 min read

You'll learn to convert between DSCP, the ToS byte and a class name, follow a mark from the endpoint to the far edge, map your classes onto a provider's shorter list, and prove with a capture which mark a packet carries.

Technical definition

DSCP mapping is the table that says which marking on a packet means which class at each point on its path: the endpoint's own marks, the edge's classes and the provider's classes. A mismatch between any two of them puts traffic in a class it was not meant for, and the packet is treated accordingly without any error being raised.

A mark is a six-bit label

The DSCP field is six bits in the IP header, so it holds a value from 0 to 63. It sits in the top six bits of the 8-bit ToS byte, and the bottom two bits carry ECN. That gives the arithmetic used for every conversion in this lesson: the ToS byte is the DSCP value times four. EF is 46, so its ToS byte is 184, which is 0xB8 in hexadecimal.

Two naming schemes cover most values. The assured forwarding classes are named AFxy, where x is the class from 1 to 4 and y is the drop precedence from 1 to 3, and the value is 8 times x plus 2 times y. So AF41 is 34 and AF43 is 38. The class selectors CSn are 8 times n, so CS3 is 24 and CS6 is 48.

Diagram
From a name to a ToS byte
From a name to a ToS byte

EF is DSCP 46, which is 101110 in binary. Two ECN bits, 00, are added at the end to make the 8-bit ToS byte 10111000. That is 184 in decimal and 0xB8 in hexadecimal.

  1. NameEF
  2. DSCP46 in binary:101110
  3. Add ECNtwo bits, 00:10111000
  4. ToS byte184, whichis 0xB8
The ToS byte is the DSCP value times four, because adding two bits at the end shifts the value left by two places.
Diagram
Common markings and their numbers
Common markings and their numbers
NameDSCPToS byteA common use (one convention)
EF46184 (0xB8)Voice media
AF4134136 (0x88)Interactive video
CS432128 (0x80)Streaming video
CS32496 (0x60)Call signalling
AF3126104 (0x68)Business-critical data
AF211872 (0x48)Transactional data
AF111040 (0x28)Bulk data
CS1832 (0x20)Scavenger, lowest priority
CS648192 (0xC0)Network control, such as routing
Default00 (0x00)Best effort
Uses follow Cisco's QoS baseline. RFC 4594 and many providers differ in places, so use the table your organisation has written down.

Where a mark is set, trusted, copied and changed

A packet is marked once at its source and then read at several places. At each one something can leave it alone, change it or ignore it. The edge's LAN interface is the trust boundary: the edge either accepts what the host sent or re-marks the packet by its own rules. Inside the tunnel, the usual behaviour is that the inner mark is copied to the outer header, because the provider can only see the outer one. The provider then honours the mark, re-marks it or ignores it. The far edge queues by its own classes.

Diagram
One mark, five readers
One mark, five readers

The endpoint sets a mark, the edge trusts or re-marks it, the tunnel copies the inner mark to the outer header, the provider honours or re-marks it, and the far edge queues by its own classes.

  1. Endpointsets the mark
  2. Edge ingresstrust orre-mark
  3. Tunnelinner mark toouter header
  4. Providerhonours,re-marks orignores
  5. Far edgequeues byits classes
Behaviour differs by platform, release and provider. A capture at each point shows which mark a packet really carries.

Your classes against the provider's classes

An enterprise often has six or more classes. A provider contract commonly sells three or four, and each one is identified by a short list of DSCP values. A value that is not in any list typically falls into the default class, with no error and no warning. The mapping table is therefore a design document to be agreed with the provider, not an afterthought.

Diagram
Six classes into four
Six classes into four

The enterprise defines six or more traffic classes, and the provider contract defines three or four. Every enterprise marking has to land in a provider class on purpose.

Your classesSix or more,your own marks
Provider contractThree or four,listed DSCP values
Write the mapping down. A marking the contract does not list is treated as best effort.
Diagram
One mapping, with a gap
One mapping, with a gap
TrafficYour markProvider class that lists itResult
Voice mediaEF (46)Real-time (EF)Carried as intended
Call signallingCS3 (24)Critical (CS3, AF31)Carried as intended
Interactive videoAF41 (34)None listedFalls into best effort
Transactional dataAF21 (18)Business (AF21 to AF23)Carried as intended
Bulk dataAF11 (10)None listedBest effort, by design
Bulk data in best effort is the intention. Interactive video in best effort is the gap.

Worked example: video breaks up only at busy times

HUB-01 and BR-02 use the private transport, whose contract is the four-class list above. Video calls between the branch and the hub break up in the afternoon, and voice calls on the same circuit stay clean. The tunnel shows no loss. A capture on the transport router, on the link toward the edge, shows what each class of traffic carries on the outer header.

Example output written for this lesson, simplified; real output has more fields and a different layout
transport$ sudo tcpdump -nvi eth1 -c 3 udp port 12346
IP (tos 0xb8, ttl 63, id 40211, flags [DF], proto UDP (17), length 220)
IP (tos 0x88, ttl 63, id 40212, flags [DF], proto UDP (17), length 1362)
IP (tos 0x0, ttl 63, id 40213, flags [DF], proto UDP (17), length 1442)
Three packets in one tunnel, with three outer marks. The first, 0xB8, is 184 divided by 4, which is DSCP 46: voice, in the Real-time class. The second, 0x88, is 136 divided by 4, which is 34: AF41, interactive video. The third is 0, best effort. The inner marks were copied correctly, so the edge is not at fault. The provider contract does not list AF41, so the video packets share the default class with bulk transfers, and they suffer when those transfers fill the queue in the afternoon.
Diagram
Evidence from the video case
Evidence from the video case

Video breaks up only at busy times while voice stays clean. The outer mark on the video packets is 0x88, which is AF41. The provider contract lists no class for AF41, so video shares the default class with bulk data. The fix is to re-mark video into a class the contract does list.

  1. SymptomVideo breaks up in the afternoonvoice on the same circuit is clean
  2. TunnelNo loss reported on the tunnelthe probes sit in another class
  3. CaptureOuter mark is 0x88, DSCP 34, AF41copied correctly from the inner packet
  4. ContractNo provider class lists AF41so it falls into best effort
  5. FixRe-mark video to AF31, or ask theprovider to list AF41
Each row narrows the cause. The capture at the edge's WAN side is the step that separates an edge fault from a contract gap.

There are two fixes and the choice is a negotiation. Re-marking video to AF31 on the edge's egress puts it in the Critical class today, at the cost of sharing that class with business-critical data. Asking the provider to list AF41 in a class keeps the design as it is but takes the provider's time. After either one, repeat the capture: the video packets should now show 0x68 for AF31, or 0x88 with a provider class that carries it.

Where to change a mark

A mark can be changed at the source, at the edge's ingress or at its egress. In Cisco SD-WAN, a centralized data policy can set the DSCP, and a localized policy can classify traffic into forwarding classes, map each class to a queue and rewrite the mark on egress. Menu names and options differ between releases, so confirm them for yours.

Diagram
Three places to change a mark
Three places to change a mark

The source host or switch fixes the mark for every path. A data policy at the edge changes it on ingress for chosen traffic. A rewrite rule at the edge's egress changes only what the provider sees.

Change the mark
  • At the sourcefixes everypath at once
  • Edge ingressdata policy,chosen traffic
  • Edge egressrewrite forthe provider
Change it as close to the source as the organisation allows, and use egress rewriting for provider-specific mapping.

Provider-specific mapping belongs at egress, because it only exists for that provider. A company-wide marking scheme belongs at the source or at ingress, so that every path, not just the WAN, sees it.

Prove the mark at each point

Do not trust a configuration to say which mark a packet carries. Generate a packet with a known mark, then capture at each point and compare. The two commands below are for a Linux test host and a Linux transport router.

ping -Q 0xb8 -c 5 198.51.100.12 sudo tcpdump -ni eth1 -c 5 'ip[1] & 0xfc == 0xb8'

The first line sends pings with the whole ToS byte set to 0xB8, which is DSCP 46. The second captures packets whose DSCP is 46: it masks the two ECN bits with 0xFC, so the match does not depend on ECN. Interface names are examples. Capture the outer header on the WAN side, which is also what the provider sees.

The capture filter masks the ToS byte with 0xFC before comparing it, so the two ECN bits cannot hide a match. The table runs six ToS bytes through that mask.

Diagram
Which ToS bytes the capture filter matches
Which ToS bytes the capture filter matches
ToS byteMatches the filter?After the 0xFC maskWhat it is
0xB8 (184)Yes0xB8DSCP 46, ECN 00
0xB9 (185)Yes0xB8DSCP 46, ECN 01
0xBA (186)Yes0xB8DSCP 46, ECN 10
0xBB (187)Yes0xB8DSCP 46, ECN 11
0x88 (136)No0x88DSCP 34 (AF41), ECN 00
0x00 (0)No0x00DSCP 0, best effort
Computed by script for the filter ip[1] & 0xfc == 0xb8. All four ECN values give 0xB8, so voice is caught whether or not ECN is in use.
Diagram
Inner header and outer header
Inner header and outer header

The inner header carries the mark the endpoint set. The outer header is the one the provider reads, so it is the one to capture on the edge's WAN side.

Inner headerMark set by the endpointCan be correct
Outer headerMark copied by the tunnelWhat the provider reads
A correct inner mark does not prove a correct outer mark.
Diagram
Capture points and what to expect
Capture points and what to expect
Capture pointWhat it showsA fault shows as
Source hostThe mark the endpoint sets0 where a mark was expected
Edge LAN sideThe mark as it enters the edgeA different value, because a switch re-marked it
Edge WAN sideThe outer mark the provider receives0 or a value the contract does not list
Far edge LAN sideThe mark after the provider and the far edgeA mark that is not the one that was sent
Compare each point with the one before it. The first point where the mark changes is where to look.

Learn more: QoS Concepts: Marking, Queueing and ShapingSLA Classes and Policy Thresholds

Test yourself

Predict · scenario 1

EF has the DSCP value 46. What is the ToS byte in decimal?

Predict · scenario 2

A capture shows an outer ToS byte of 0x68. Which class is that?

Predict · scenario 3

Video is marked AF41, and the provider contract lists no class for AF41. What usually happens to it?

Predict · scenario 4

The inner packets are marked EF, but the provider's Real-time class is not carrying the voice. What do you capture first?

Predict · scenario 5

Where should provider-specific mapping, such as AF41 to AF31 for one carrier, be applied?

Predict · scenario 6

A capture is running with the filter ip[1] & 0xfc == 0xb8. A packet arrives with the ToS byte 0xBA. Is it captured?

Predict · scenario 7

What are the DSCP value and the ToS byte of AF43?

Predict · scenario 8

At the edge, the LAN-side capture shows voice with the ToS byte 0xB8, and the WAN-side capture shows the tunnel packets with the ToS byte 0. Where was the mark lost?

FAQ

Is a higher DSCP number a higher priority?
No. The number is a label. Priority comes from the queue that the class is mapped to. CS6, value 48, is higher than EF, value 46, and yet voice is the traffic that usually gets the strict-priority queue.
What is the difference between DSCP and IP precedence?
Precedence is the top three bits of the ToS byte. DSCP is the top six. The class selector values, CS1 to CS7, keep the lower three DSCP bits at zero so that they read the same as the old precedence values.
Will an internet transport honour my marks?
Often not. Many internet paths ignore the mark or reset it, so on a broadband circuit the mark mainly helps the edge's own egress queue. Whether a private circuit honours marks depends on the contract, which is why the class table matters.
Why check the outer header, not only the inner one?
The provider sees only the outer header of the tunnel packet. The inner mark can be perfect while the outer mark is zero, and the provider then queues the packet as best effort.