When QoS helps
As long as a line has enough bandwidth, every packet gets through immediately and QoS changes nothing. But when more arrives than a port can send (typically: fast LAN, slow WAN line), packets have to wait. A queue without rules treats all of them the same: voice waits behind large data packets and is lost when the queue is full (tail drop). QoS makes sure important traffic goes first. It does not create more bandwidth.
Marking: DSCP and PCP
With Differentiated Services (DiffServ, architecture RFC 2475) the sender or the first network device marks each packet, and the devices along the way treat it according to that marking.
| Where | Field | Size | Standard |
|---|---|---|---|
| IPv4 header, byte 2 (formerly TOS) | DSCP | 6 bits (0–63) + 2 bits ECN | RFC 2474, RFC 3168 |
| IPv6 header | Traffic Class | same as IPv4 | RFC 2474 |
| 802.1Q tag (trunks only) | PCP | 3 bits (0–7) | IEEE 802.1Q |
Recommended classes according to RFC 4594:
| Traffic | DSCP | Value | PCP |
|---|---|---|---|
| Network control (routing) | CS6 | 48 | 6 |
| Telephony (voice) | EF (RFC 3246) | 46 | 5 |
| Signalling (SIP) | CS5 | 40 | 5 |
| Video, conferencing | AF41 (RFC 2597) | 34 | 4 |
| Business data | AF21 | 18 | 2 |
| Normal | Default (best effort) | 0 | 0 |
| Background | CS1 | 8 | 1 |
The class selectors (CS0–CS7) are compatible with the old IP precedence values: the top three bits of the DSCP give the class. This is how a switch maps DSCP to PCP: EF = 101110 → 101 = 5.
| Field | Length | Example value | Meaning |
|---|---|---|---|
| Version | 4 bits | 4 | 4 for IPv4. |
| IHL | 4 bits | 5 | Internet header length in 32-bit words: 5 = 20 bytes without options. |
| DSCP | 6 bits | 0 | Differentiated services: traffic class for quality of service (RFC 2474), 0 = best effort. |
| ECN | 2 bits | 0 | Explicit congestion notification: routers signal congestion without dropping packets (RFC 3168). |
| Total length | 16 bits (2 bytes) | 140 | Length of header and payload in bytes, at most 65,535. |
| Identification | 16 bits (2 bytes) | 0x0006 | Packet number; all fragments of a packet carry the same one. |
| Flags | 3 bits | DF | Bit 0 reserved, DF = don't fragment, MF = more fragments follow. |
| Fragment offset | 13 bits | 0 | Position of the fragment in the original packet, in steps of 8 bytes. |
| TTL | 8 bits | 64 | Time to live: each router subtracts 1; at 0 the packet is dropped (ICMP time exceeded). |
| Protocol | 8 bits | 6 | What is inside: 1 ICMP, 6 TCP, 17 UDP, 50 ESP, 89 OSPF. |
| Header checksum | 16 bits (2 bytes) | 0x9aa7 | Checksum over the header only (RFC 1071); each router recalculates it because of the TTL. |
| Source IP | 32 bits (4 bytes) | 192.168.10.100 | Sender, unchanged along the whole path (except with NAT). |
| Destination IP | 32 bits (4 bytes) | 192.168.20.10 | Destination, routers decide the path by it. |
| Options (optional) | 0–40 bytes | Rarely used (e.g. record route); IHL is then greater than 5. | |
| Payload | ≤ 65515 bytes | 120 Byte | The segment or message of the next layer (TCP, UDP, ICMP …). |
Queues
A device with QoS has several queues per port. With strict priority (priority queuing) it always sends from the most important non-empty queue first. That is ideal for voice, which needs little bandwidth but cannot tolerate delay. For a lot of high-class traffic, devices additionally use weighted methods (e.g. weighted fair queuing) so that the lower classes do not starve.
Trust: a switch port to a PC should not accept markings, otherwise anyone could mark their traffic as “voice”. Without trust, the device resets the DSCP of incoming packets to 0.
In leyoNET
- Router, switch, layer 3 switch, firewall: settings → QoS. “Enable QoS” activates four strict-priority queues: voice (EF), signalling and network control (CS5–CS7), preferred data (AF, CS2–CS4), best effort.
- Bandwidth per port (e.g.
2M): congestion only happens there; without an entry the port sends at unlimited speed. At most 40 frames per queue, then tail drop (in the packet list: “dropped (queue full)”). - IP phones mark voice with EF and SIP with CS5;
iperf -c <IP> -u -b 4Mon a PC generates load. - On trunks the 802.1Q tag carries the PCP derived from the DSCP; the bytes show both.
How to do it in leyoNET
The same text as in the app’s help (F1 key).
Quality of Service (QoS)
QoS prefers important traffic when a line is full. Without congestion no QoS is needed.
- Marking: the 6-bit DSCP field in the IP header (RFC 2474) says how important a packet is. IP phones mark voice with EF (46, RFC 3246) and SIP with CS5 (40), as recommended by RFC 4594. In the 802.1Q tag, PCP (3 bits) carries the priority across trunks.
- Bottleneck: enter a bandwidth per port under QoS (e.g. 2M for a WAN line). If more arrives than the port can send, the rest waits in a queue; when it is full, packets are lost.
- Priority queues: with “Enable QoS” there are four queues; voice always goes first (strict priority).
- Trust: without “Trust DSCP” the device resets incoming markings to 0, e.g. on ports to PCs.
- Generate load: “iperf -c <IP> -u -b 3M” on a PC. Check: call with “call” and the quality in the Telephony tab.
See an example
- Telephony with QoS over a WAN line
Two sites, connected by a 2 Mbit/s line. A PC loads it with 4 Mbit/s while phones 201 and 202 call each other via the phone system (SIP, RTP). Thanks to QoS the voice still arrives cleanly.
Filter “sip”: REGISTER, INVITE, 180 Ringing, 200 OK, ACK, BYE. Filter “rtp”: the voice packets with DSCP EF. After the call the phone shows loss, delay and jitter.
“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.
Practise
- ★★★★☆ Calling despite a full line (QoS) · 2 goals · Worksheet (German)
In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.
What leyoNET simplifies
| Protocol | Layer | Simplification in the simulation |
|---|---|---|
| DiffServ (DSCP), 802.1p | 3 | DSCP in the IPv4 header, PCP in the 802.1Q tag from the top three DSCP bits; four strict-priority queues only on ports with a configured bandwidth, tail drop at 40 frames; no WRED, no policing, no custom class rules (marking by the phones) |
Standards
- RFC 2474 – Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers
- RFC 2475 – An Architecture for Differentiated Services
- RFC 3246 – An Expedited Forwarding PHB (Per-Hop Behavior)
- RFC 2597 – Assured Forwarding PHB Group
- RFC 4594 – Configuration Guidelines for DiffServ Service Classes
- IEEE 802.1Q – Bridges and Bridged Networks (current edition: IEEE 802.1Q-2022)