IPv4 - ToS Byte definition
The Type of Service (ToS) byte found within the IPv4 header is used extensively with Quality of Service mechanisms. Over the years it has gone through several modifications in definition.
Original ToS Definition
Originally defined in RFC 791, it looked like this:
- The first 3 bits were used to define eight levels of precedence. The higher the value, the more important the IP packet is, in case of congestion, the router would drop the low-priority packets first.
- The type of service bits are used as flags to assign what kind of delay, throughput, and reliability we want.
One of the problems with this original definition is that it is possible to create a scenario where you can have an IP packet that requests low delay and high throughput. The problem is that this can create a contradiction in the network. Low Delay and High Throughput are often seen as mutually exclusive in networking.
Revised ToS Definition
With RFC 1349, the ToS byte was revised to look like this:
- The first three precedence bits remain unchanged.
- Instead of five bits, we now only use four bits to assign the type of service
- The final bit is called MBZ (Must Be Zero). This bit isn’t used, the RFC says it’s only been used for experiments, and routers will ignore this bit.
The type of service bits which still act like flags, have been modified to resolve the possible contradictory combinations.
Differentiated Services
With RFC 2474 the ToS field has been renamed and revised like so:
The first 6 bits of the DS field are used to set a codepoint that will affect the PHB (Per-Hop Behavior) at each node. The codepoint is also what we call the DSCP value. The CU bits are "currently unused".
Links
https://forum.networklessons.com/t/ip-precedence-and-dscp-values/1135/103?u=lagapidis
https://networklessons.com/quality-of-service/ip-precedence-dscp-values
https://datatracker.ietf.org/doc/html/rfc791