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.
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.
- NameEF
- DSCP46 in binary:101110
- Add ECNtwo bits, 00:10111000
- ToS byte184, whichis 0xB8
| Name | DSCP | ToS byte | A common use (one convention) |
|---|---|---|---|
| EF | 46 | 184 (0xB8) | Voice media |
| AF41 | 34 | 136 (0x88) | Interactive video |
| CS4 | 32 | 128 (0x80) | Streaming video |
| CS3 | 24 | 96 (0x60) | Call signalling |
| AF31 | 26 | 104 (0x68) | Business-critical data |
| AF21 | 18 | 72 (0x48) | Transactional data |
| AF11 | 10 | 40 (0x28) | Bulk data |
| CS1 | 8 | 32 (0x20) | Scavenger, lowest priority |
| CS6 | 48 | 192 (0xC0) | Network control, such as routing |
| Default | 0 | 0 (0x00) | Best effort |
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.
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.
- Endpointsets the mark
- Edge ingresstrust orre-mark
- Tunnelinner mark toouter header
- Providerhonours,re-marks orignores
- Far edgequeues byits classes
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.
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.
| Traffic | Your mark | Provider class that lists it | Result |
|---|---|---|---|
| Voice media | EF (46) | Real-time (EF) | Carried as intended |
| Call signalling | CS3 (24) | Critical (CS3, AF31) | Carried as intended |
| Interactive video | AF41 (34) | None listed | Falls into best effort |
| Transactional data | AF21 (18) | Business (AF21 to AF23) | Carried as intended |
| Bulk data | AF11 (10) | None listed | Best effort, by design |
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.
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)
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.
- SymptomVideo breaks up in the afternoonvoice on the same circuit is clean
- TunnelNo loss reported on the tunnelthe probes sit in another class
- CaptureOuter mark is 0x88, DSCP 34, AF41copied correctly from the inner packet
- ContractNo provider class lists AF41so it falls into best effort
- FixRe-mark video to AF31, or ask theprovider to list AF41
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.
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.
- At the sourcefixes everypath at once
- Edge ingressdata policy,chosen traffic
- Edge egressrewrite forthe provider
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.
| ToS byte | Matches the filter? | After the 0xFC mask | What it is |
|---|---|---|---|
| 0xB8 (184) | Yes | 0xB8 | DSCP 46, ECN 00 |
| 0xB9 (185) | Yes | 0xB8 | DSCP 46, ECN 01 |
| 0xBA (186) | Yes | 0xB8 | DSCP 46, ECN 10 |
| 0xBB (187) | Yes | 0xB8 | DSCP 46, ECN 11 |
| 0x88 (136) | No | 0x88 | DSCP 34 (AF41), ECN 00 |
| 0x00 (0) | No | 0x00 | DSCP 0, best effort |
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.
| Capture point | What it shows | A fault shows as |
|---|---|---|
| Source host | The mark the endpoint sets | 0 where a mark was expected |
| Edge LAN side | The mark as it enters the edge | A different value, because a switch re-marked it |
| Edge WAN side | The outer mark the provider receives | 0 or a value the contract does not list |
| Far edge LAN side | The mark after the provider and the far edge | A mark that is not the one that was sent |
Learn more: QoS Concepts: Marking, Queueing and ShapingSLA Classes and Policy Thresholds
Test yourself
EF has the DSCP value 46. What is the ToS byte in decimal?
A capture shows an outer ToS byte of 0x68. Which class is that?
Video is marked AF41, and the provider contract lists no class for AF41. What usually happens to it?
The inner packets are marked EF, but the provider's Real-time class is not carrying the voice. What do you capture first?
Where should provider-specific mapping, such as AF41 to AF31 for one carrier, be applied?
A capture is running with the filter ip[1] & 0xfc == 0xb8. A packet arrives with the ToS byte 0xBA. Is it captured?
What are the DSCP value and the ToS byte of AF43?
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?