TOS in Computing: Definition, Uses and Common Issues
In this article
In computer networking, TOS (Type‑of‑Service) is the field in an IP packet header that tells routers how to prioritize and handle that packet; in software and online platforms, TOS commonly stands for Terms of Service, the legal agreement between a provider and its users.
Background: Where the Acronym Comes From
The abbreviation TOS originated in the early days of the Internet Protocol (IP) as a two‑letter code for "Type‑of‑Service". It was introduced in the original IPv4 specification (RFC 791, 1981) to give senders a way to request preferential treatment for certain traffic, such as low‑delay voice packets. The same three‑letter acronym later became standard shorthand for "Terms of Service" in software licensing and web‑site agreements, a usage that spread with the rise of commercial internet services.
How the TOS Field Works in IPv4
The IPv4 header includes an 8‑bit TOS byte. The first three bits were originally defined for precedence, while the remaining five bits indicated specific service requirements:
- Precedence (bits 0‑2): values 0‑7, where higher numbers request higher priority.
- Delay (bit 3): a 0 means normal delay, 1 requests low delay.
- Throughput (bit 4): a 0 means normal throughput, 1 requests high throughput.
- Reliability (bit 5): a 0 means normal reliability, 1 requests high reliability.
- Cost (bit 6): a 0 means normal cost, 1 requests low‑cost routing.
Modern networks largely ignore the original TOS bits and instead interpret the same byte as the Differentiated Services Code Point (DSCP) and Explicit Congestion Notification (ECN) fields, as defined in RFC 2474 and RFC 3168. The DSCP uses the six most‑significant bits to convey a class of service, while the two least‑significant bits carry ECN flags.
How to Set or Read TOS/DSCP on Common Operating Systems
Most end‑users never need to touch TOS directly, but developers and network engineers can manipulate it with a few command‑line tools. Below are the typical ways to view or set the field on Windows, Linux, and macOS.
- Linux (iproute2):
- View current DSCP:
ip -s -d link show dev eth0(look for "tos" in the output). - Set DSCP for outgoing traffic:
iptables -t mangle -A OUTPUT -p tcp --dport 80 -j DSCP --set-dscp-class EF(EF = Expedited Forwarding, DSCP value 46).
- View current DSCP:
- Windows (PowerShell):
- Read TOS of a packet capture using
Get-NetTCPConnectionand inspecting theTrafficClassproperty. - Set TOS on a socket in code:
socket.SetIPOption(IPOptionName.TypeOfService, 0x10)(0x10 = low‑delay).
- Read TOS of a packet capture using
- macOS (pfctl and sysctl):
- Inspect packets with
tcpdump -i en0 -v; the "tos" value appears in the header line. - Apply a rule in
/etc/pf.confto mark packets:pass out on en0 proto tcp from any to any port 443 keep state tos 0xB8(0xB8 = DSCP AF31).
- Inspect packets with
Note that menu names and command syntax can differ between OS versions; always consult the current man pages or official help topics.
Common Problems and How to Fix Them
Even though the TOS field is simple, several practical issues arise when it is used in real networks.
- Routers ignore TOS: Many ISP routers treat the field as legacy and forward packets with default priority. If you need guaranteed QoS, configure QoS policies on the routers you control rather than relying on end‑host TOS settings.
- Conflicting QoS policies: A switch may map DSCP values to internal queues that differ from the intended class. Verify the switch’s QoS mapping table and adjust it to match the DSCP values you set.
- Security devices reset TOS: Firewalls and NAT devices sometimes zero out the TOS byte for security or compatibility reasons. Check the firewall’s packet‑inspection settings and enable “preserve DSCP” if available.
- Mis‑typed values: Setting an invalid DSCP (e.g., a value outside 0‑63) will be silently truncated to the nearest valid value. Use the predefined DSCP class names (EF, AF21, CS3, etc.) to avoid mistakes.
If a packet you expect to be low‑delay still experiences latency, start with the simplest checks:
- Restart the network interface to clear any stale QoS state.
- Run
ping -Q 0x10(Linux) to send ICMP with the low‑delay TOS bit and observe round‑trip times. - Confirm that intermediate devices show the same TOS value with
tcpdump -v. - If the value changes, adjust the device’s QoS policy or disable the feature that rewrites TOS.
Comparison: TOS vs. DSCP vs. QoS Policies
Understanding the relationship between the historic TOS field and modern QoS mechanisms helps avoid confusion.
- TOS (original): An 8‑bit field with coarse precedence and service flags; rarely used directly today.
- DSCP: The six most‑significant bits of the same byte, providing up to 64 distinct service classes. It is the de‑facto standard for traffic classification.
- QoS Policies: Router‑ or switch‑level configurations that map DSCP values to specific queues, shaping, or policing actions. QoS is the enforcement layer; DSCP is the signaling layer.
In practice, you set DSCP on the host, and the network devices enforce QoS based on that DSCP. The old TOS bits (delay, throughput, reliability, cost) are effectively obsolete, but some legacy equipment still reads them.
Security and Safety Considerations
Manipulating TOS/DSCP does not expose a system to direct security risks, but careless use can have indirect consequences.
- Denial‑of‑service amplification: Marking large volumes of traffic as high‑priority may cause downstream routers to allocate excessive resources, potentially degrading service for other users.
- Policy bypass: Some corporate networks rely on DSCP to enforce bandwidth caps. Overriding the field without authorization may violate acceptable‑use policies.
- Legal compliance: When TOS is used to mean Terms of Service, failing to read or accept the agreement can lead to breach of contract. Always scroll through the full Terms of Service before clicking "I Agree".
Therefore, only set TOS/DSCP on traffic you control, and respect any organizational QoS policies.
Frequently Asked Questions
What does a TOS value of 0x10 mean?
0x10 sets the "low‑delay" bit in the original TOS definition. In modern DSCP interpretation it maps to a DSCP value of 4 (binary 000100), which is rarely used by default but can be mapped to a low‑latency queue.
Can I see the TOS field in a Windows "Task Manager"?
No. Task Manager does not expose packet‑level details. Use PowerShell's Get-NetTCPConnection or a packet capture tool such as Wireshark to view the TOS/DSCP values.
Do mobile phones set TOS automatically for video calls?
Most modern mobile operating systems set DSCP values for real‑time traffic (e.g., EF for VoIP) when the app requests it via the socket API. The actual mapping depends on the carrier’s network policies.
Is "TOS" considered slang when referring to Terms of Service?
No. "TOS" as an abbreviation for Terms of Service is a widely accepted, standard shorthand in software documentation and legal notices. It is not informal slang.
Why does my ISP say they ignore DSCP?
Many consumer‑grade ISP networks treat all traffic equally to simplify provisioning. They may strip or reset the DSCP bits at the edge, which is why QoS often only works on private corporate or campus networks where you control the routers.
How can I test whether my router preserves DSCP?
Capture traffic on both sides of the router with Wireshark. Send a packet with a known DSCP (e.g., ping -Q 0xB8 on Linux for DSCP AF31). Compare the "tos" field before and after the router; if the value is unchanged, DSCP is preserved.