What QoS solves
A branch has a 100 Mbps internet circuit. A video backup starts and fills it. Voice calls on the same circuit begin to break up, because voice packets now wait in the same line as backup packets or are dropped. QoS is how the router is told that voice goes first and the backup can wait. The router needs three things to do this: a way to tell the traffic apart, a way to treat each kind differently, and a limit that matches the real speed of the circuit.
Classify, mark, queue, shape.
- Classifywhich traffic
- Markset DSCP
- Queuewhich classwaits where
- Shapeto circuitspeed
Classification answers which traffic this is. Marking writes the answer into the packet. Queueing answers who waits where. Policing answers whether a class stays inside a rate by dropping the excess. Shaping answers whether the whole interface stays at the circuit speed by delaying the excess.
- Classifywhich trafficis this?
- Markwrite DSCPinto the packet
- Queuewho waits,who is first
- Policecut a classto a rate
- Shapehold the linkto circuit speed
Classify and mark
Classification picks out traffic by address, port, protocol or application. Marking then writes a class into the packet so that later devices can act on it without repeating the work. In IP, the marking is the Differentiated Services Code Point (DSCP) in the IP header. Common values are 46 (EF) for voice, 34 (AF41) for interactive video, 26 (AF31) for business data, 0 for best effort and 8 (CS1) for scavenger traffic that may be dropped first. Mark as close to the source as can be trusted.
| Class | DSCP | Queue treatment | Example |
|---|---|---|---|
| Voice | 46 (EF) | Strict priority, small share | Voice calls |
| Interactive video | 34 (AF41) | Guaranteed share | Meetings |
| Business data | 26 (AF31) | Guaranteed share | ERP, databases |
| Default | 0 | Remainder | General web |
| Scavenger | 8 (CS1) | Lowest, dropped first | Backups, updates |
A source that is managed and trusted, such as a voice gateway, can keep the marking it set. A source that is not trusted, such as a guest network, has its marking reset at the first edge by matching on address and port.
Queue and schedule
Each class goes into its own queue. A scheduler picks which queue is served next. A priority queue is served ahead of the others, which suits voice but would starve everything else if it had no limit, so it is given a small cap. Other queues share what is left according to weights. When a queue is full, the next packet that arrives for it is dropped. In Cisco SD-WAN, localized policy maps forwarding classes to a limited number of queues on the WAN Edge, and the number and defaults depend on the platform and release.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Policing and shaping
Policing and shaping both enforce a rate. A policer drops or re-marks traffic that exceeds the rate, and so adds no delay but gives drops. A shaper holds excess packets in a buffer and sends them out later at the configured rate, which adds some delay and avoids drops. Use shaping on a WAN interface to match the circuit, and policing to limit a class, such as guest traffic.
Without a shaper the router sends at the speed of its fast port and the provider's device drops the excess without knowing the classes. With a shaper set to the circuit speed, the queue builds on the router, which knows which class to protect.
Same rate, different effect on excess traffic.
- Shape to the circuit speed that you pay for, not to the interface speed.
- Leave a little headroom, because IPsec adds overhead that is not counted in the user's traffic.
- Remember that queues only work in the direction they are applied: outbound on the WAN interface. Traffic coming from the provider is not queued by your router.
Encapsulation overhead and the real rate
Rates in a class plan are usually written from the user's point of view, but the circuit carries the encapsulated packets. Every packet gains the IPsec headers, so small packets grow by a large fraction. The table assumes 70 bytes of added overhead per packet and 50 packets per second per call (a packet every 20 ms). The real overhead depends on the cipher, on NAT traversal and on the release.
| Codec | Packet before | Packet after | Rate before | Rate after | Growth |
|---|---|---|---|---|---|
| G.711 (160 byte payload) | 200 bytes | 270 bytes | 80 kbps | 108 kbps | 35 % |
| G.729 (20 byte payload) | 60 bytes | 130 bytes | 24 kbps | 52 kbps | 117 % |
The growth matters most when a priority cap is sized. A cap holds a fixed number of kilobits per second, so the number of calls it can carry depends on the rate on the wire, not the rate the phone sends.
| Codec and cap | Calls if sized from the user rate | Calls that fit on the wire | Overestimate |
|---|---|---|---|
| G.711, cap 33 percent (31,350 kbps) | 391 calls | 290 calls | 101 calls, 35 percent |
| G.729, cap 33 percent (31,350 kbps) | 1,306 calls | 602 calls | 704 calls, 117 percent |
| G.711, cap 20 percent (19,000 kbps) | 237 calls | 175 calls | 62 calls, 35 percent |
| G.729, cap 20 percent (19,000 kbps) | 791 calls | 365 calls | 426 calls, 117 percent |
Reading a queue counter
The practical check is whether a class is being dropped. The output below is an example of a policy-map counter on a WAN interface. The exact layout depends on the platform and release.
BR-01#show policy-map interface GigabitEthernet1 output Class-map: VOICE (priority) packets 482113 dropped 0 Class-map: BUSINESS packets 904551 dropped 12 Class-map: class-default packets 3320871 dropped 41872
Drops in the priority class mean its cap or the shaping rate is wrong. Drops only in the default class mean the queue forms on the router and is doing its job. No drops anywhere while users complain mean the queue is forming somewhere else, such as at the provider.
- Drops in VOICEPriority cap or shaping rate is wrongCheck against the encapsulated rate
- Drops only in class-defaultThe queue forms on the routerThe plan is working
- No drops, users complainThe queue forms somewhere elseCheck the shaper and the provider
A worked case: voice breaks up and nothing is dropped
BR-01 has a 1 Gbps port on a 100 Mbps internet circuit. Every afternoon a backup starts and voice calls break up for twenty minutes. The branch policy marks voice as DSCP 46 and the queue plan is in place, so Priya reads the counters on the WAN interface during a bad period.
BR-01#show policy-map interface GigabitEthernet1 output Class-map: VOICE (priority) packets 120331 dropped 0 Class-map: BUSINESS packets 301402 dropped 0 Class-map: class-default packets 1840277 dropped 0
Voice breaks up during the backup, while the router counters show no drops in any class. The circuit is sold at 100 megabits and the router port runs at 1 gigabit, with no shaper. The provider's device is dropping the excess without knowing which packets are voice. A shaper below the circuit speed moves the queue to the router.
- SymptomCalls break up during the backupEvery afternoon for about twenty minutes
- CountersZero drops in every classThe router queue did not form
- Cause1 Gbps port on a 100 Mbps circuit, no shaperThe provider drops the excess blindly
- FixShape a little below the circuit speedRe-read counters and provider utilisation
| Setting | Before | After |
|---|---|---|
| Shaping rate on the WAN interface | None | 95,000 kbps |
| Priority queue cap for voice | Unchanged | Unchanged, checked against the encapsulated rate |
BR-01#show policy-map interface GigabitEthernet1 output Class-map: VOICE (priority) packets 119870 dropped 0 Class-map: BUSINESS packets 298114 dropped 0 Class-map: class-default packets 1795022 dropped 38211
| Symptom | First check | Likely cause |
|---|---|---|
| Voice breaks up, no drops on the router | Is a shaping rate set below the circuit speed? | The queue forms at the provider, not on the router |
| Voice shows drops on the router | The priority cap against the encapsulated call rate | A cap sized from the unencapsulated rate |
| Every class drops about equally | Marking and the class maps | Traffic is not matched, so it lands in the default class |
| Marking is correct but the provider ignores it | The provider's service terms | The circuit does not honour DSCP |
Learn more: Application-Aware Routing IntroductionForwarding, MTU and Tunnel Encapsulation
Test yourself
A branch has a 1 Gbps port and a 100 Mbps circuit. Voice breaks up during a backup, but the router shows no queue drops. What is the likely cause?
A shaper is set at 95 Mbps on a 100 Mbps circuit. During a backup the default class shows drops and voice shows none. Is that a fault?
A G.729 call sends 20 byte payloads every 20 ms. Adding 70 bytes of encapsulation to each packet, by how much does its rate on the wire grow?
Voice is dropped on the WAN Edge during busy periods, but the priority cap was sized from the unencapsulated call rate. What should be checked?
Which tool delays excess traffic instead of dropping it at once?
Why is the priority queue given a cap?
A voice cap of 33 percent of a 95,000 kbps shaper (31,350 kbps) was sized from the user rate of G.711 calls, 80 kbps each. With 70 bytes of encapsulation added, how many calls does the cap hold?
The counters show drops in VOICE (priority) and none in class-default. Which reading fits?
A guest network sends traffic that carries its own DSCP 46 marks toward the WAN Edge. What is the sensible handling?