ArticleslgStudy

science

Type of service

Type of service is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Type of service rather than just read about it. In short: The type of service (ToS) field is the second byte of the IPv4 header. It has had various purposes over the years, and has been defined in different ways by five RFCs.

Key takeaways

  • Type of service belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Type of service to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Type of service from memory before moving on to harder problems.

Reference excerpt

The type of service (ToS) field is the second byte of the IPv4 header. It has had various purposes over the years, and has been defined in different ways by five RFCs. Before the redefinition, the ToS field could specify a datagram's priority and request a route for low-latency, high-throughput, or highly-reliable service. Based on these ToS values, a packet would be placed in a prioritized outgoing queue or take a route with appropriate latency, throughput, or reliability. In practice, the ToS field never saw widespread use outside of the US Department of Defense networks. However, a great deal of experimental, research, and deployment work has focused on how to make use of these eight bits, resulting in the current DS field definition. The modern redefinition of the ToS field (as well as the Traffic Class field in IPv6 packets) splits this byte into a 6-bit Differentiated Services (DS) field and a 2-bit Explicit Congestion Notification (ECN) field. While Differentiated Services is somewhat backwards compatible with ToS, ECN is not.

History The Type of Service field in the IP header was originally defined in RFC 791, and has been interpreted for IP Precedence and ToS ever since. The definition was largely derived from a US DoD Specification JANAP-128, which defines message multilevel precedence and preemption. It defined a mechanism for assigning a precedence to each IP packet, as well as a mechanism to request specific treatment such as high throughput, high reliability, or low latency, etc. In the RFC 1349 update, the Monetary Cost bit is introduced (this bit was previously marked "Reserved for Future Use"). Section 2.4 of RFC 1583 (OSPFv2) introduces a ToS-aware routing method. In practice, only the IP Precedence part of the field was ever used outside US DoD networks: the higher the value of the IP Precedence field, the higher the priority of the IP packet. Some US DoD networks did use the delay bit for route selection between oceanic cable paths and Satellite Communication (SATCOM) paths when both paths existed. IPv6 has never had an IPv4-like "traditional" ToS field, partially because the authors were aware of DiffServ efforts at its drafting (RFC 2460 Section 7). In RFC 2474, the definition of this entire field was changed. It is now called the "DS" (Differentiated Services, "DiffServ") field, and the upper 6 bits contain a value called the "DSCP" (Differentiated Services Code Point). The upper 3 bits of DS maintain compatibility with IP Precedence. Since RFC 3168, the remaining two bits (the two least significant bits) are used for Explicit Congestion Notification. RFC 8622 added lower-effort (LE) DS for traffic that may be pre-empted by other traffic (best-effort traffic). It is intended for background traffic of low precedence, such as bulk data transfers with low priority in time.

Allocation

Precedence and ToS Before its deprecation, the Type of Service field was defined as follows from RFC 791:

Precedence was a 3 bit field which treats high priority packets as more important than other packets. If a router is congested and needs to discard some packets, it will discard packets having the lowest priority first. Although the precedence field was part of IP version 4, it was never used. RFC 1349 introduced an additional "low-cost" field. The four available ToS bits now become:

The naming here follows the convention of Unix operating systems. RFC 1349 and RFC 1060 only show examples of one bit used at a time for application-default values, although RFC 791 mentions that at most two of the three indications it has should be set nominally. One such use is known from mod_iptos. Because the last three bits went through many definitions prior to RFC 2474 (see below), documentation and implementations may be confusing and contradictory.

DSCP and ECN

RFC 2474 (which was released in December 1998) reserved the first six bits of the DS (or IPv4 ToS) field for the Differentiated Services Code Point (DSCP), and RFC 3168 reserved the last two bits for Explicit Congestion Notification.

DSCP defines a Class Selector (CS) naming for each value it defines, mirroring what would have been interpreted as the IP Precedence if one follows the older specification:

DSCP Nomenclature:

CS Class Selector (RFC 2474) AFxy Assured Forwarding (x=class, y=drop precedence) (RFC 2597) EF Expedited Forwarding (RFC 3246) LE Lower-Effort (RFC 8622) The above table, with individual values written out for values of the entire ToS field (not to be confused with the little-used 5-bit part):

Note: In the above table, ToS is shown in decimal format. However, many routers express ToS in hex format.

Example: mixed interpretation Let's start with an IP precedence of 1, or 001 in binary. The entire ToS field would then be 001 00000, assuming that the unused 5 bits are zero. The DSCP can be interpreted by resegmenting to 001000 00, where 001000 = 8 is the DSCP value, corresponding to CS1.

Software support Although not frequently used, IP ToS definitions are widely found in netinet/ip.h of Unix-like or Unix operating systems as IPTOS_FIELDNAME macros. The "lowcost" field is commented out in OpenBSD due to its newer use for indicating ECN support. Remnants of the old RFC 1349 terminology can be found in Transmission 2.93 as well as other tools that support setting this field. An old Apache module, "mod_iptos", once packaged in Ubuntu, notes that a way to use multiple RFC 1349 option bits together emerged after some point.

See also Class of service Quality of service Explicit Congestion Notification

References

Further reading John Evans, Clarence Filsfils (2007). Deploying IP and MPLS QoS for Multiservice Networks: Theory and Practice. Morgan Kaufmann. ISBN 978-0123705495.

External links Linux Advanced Routing & Traffic Control. How to set ToS byte via IPChains Simple Traffic Queueing by ToS values

Worked examples

Example 1 — a first encounter with Type of service

Start with the simplest possible case. Write down what Type of service claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Type of service before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Type of service ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Type of service

In research
Type of service appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Type of service in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Type of service is common in secondary-school and first-year university syllabi. It links to neighbouring topics Internet terminology, so understanding it makes those chapters shorter.
In everyday life
Look for Type of service outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Type of service in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Type of service means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Type of service out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Type of service in simple terms?

The type of service (ToS) field is the second byte of the IPv4 header. It has had various purposes over the years, and has been defined in different ways by five RFCs.

Why does Type of service matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Type of service?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Type of service.

Tags

  • Internet terminology

Keep exploring