People using NetFlow Analyzer might wonder, What do these reports about DSCP and ToS actually mean? In this blog, we’ll explain these fields in detail. Show The NetFlow packets exported from the device originally contain ToS value on each flow. Analysis software derives the DSCP from the ToS value. Type of Service (ToS)The ToS field, originally defined in RFC 791, is present in the IP header. The ToS octet consists of three fields. The last 3 bits (7, 6, 5) are for the first field, labeled “Precedence,” intended to denote the importance or priority of the datagram. The second field, labeled “TOS,” denotes how the network should make tradeoffs between throughput, delay, reliability, and cost. The first field, labeled “MBZ” (for “must be zero”) above, is currently unused. The originator of a datagram sets this field to zero (unless participating in an Internet protocol experiment which makes use of that bit). Routers and recipients of datagrams ignore the value of this field. This field is copied on fragmentation. Differentiated Services Code Point (DSCP)The definition of ToS was changed entirely in RFC 2474, and it is now called Differentiated Service (DS). On the eight fields, the upper six bit contain value called Differentiated Services Code Point (DSCP). The last two bits are used for Explicit Congestion Notification and it is defined in RFC 3168. Interpretation of ToS and DSCP fieldsDSCP interpretation (RFC 2474)RFC 791 and RFC 1349In DSCP, the most significant three bits are directly proportional to IP Precedence. Below is a DSCP to IP Precedence conversion table.
NetFlow Analyzer’s DSCP and ToS reportsNetFlow Analyzer reports on both DSCP and ToS. The DSCP report generated from NetFlow Analyzer will show each DSCP marking traffic utilization and application and conversation marked for DSCP. The ToS report shows corresponding ToS values for each DSCP. Reference: http://bogpeople.com/networking/dscp.shtml Learn what QoS baselines Cisco recommends. Download a 30-day, free trial of NetFlow Analyzer. Download | Interactive demo | Customers Internet Protocol network packets can have one byte in the IP header defining what kind of service (and priority) the packet contains. The same one byte is used for both Type of Service (ToS) classifications and differentiated services code point (DSCP) values. The Type of Service byte was defined in 1981. The differentiated services code point (DSCP) byte was later defined in December 1998. Both share the same byte in the IP packet header so they are the exact same field even though the byte is interpenetrated as meaning different things depending on how you look at the byte. Type of Service (ToS)[edit]The ToS (Type of Service) byte inside the IP header can be used for prioritization of packets inside a network. The field was defined in the RFC 791 IP protocol specification published in September 1981. The Type of Service octet consists of three fields (RFC 1349): 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ | | | | | PRECEDENCE | TOS | MBZ | | | | | +-----+-----+-----+-----+-----+-----+-----+-----+The first 3 bits of a ToS field indicate precedence.
Differentiated services fields (DS field)[edit]Everyone was happy with good old simple Type of Service codes until RFC 2474 defined a Differentiated Services Field (DS Field) using the IP protocols Type of Service byte in December 1998. The differentiated services code point (DSCP) values are defined by the first six bits of the DSCP/ToS byte. The last two bits can and are being used for ECN (Explicit Congestion Notification) as defined in RFC 3168. DSCP defines several traffic classes. The primary DSCP classes are, per RFC 4594, and RFC 8622:
Higher numbered queues within the "Assured Forwarding" sub-classes have lower priority. (AF41 has a higher priority than AF42). However, AF21-AF23 will have a higher priority than AF11-AF13. The "Class Selector" values select class types, not priority. The DSCP and The ToS Byte Values[edit]Service class names are defined in RFC 4594, RFC 5865, and RFC 8622.
Home users who want to set the DSCP fields (even though the ISP will likely not care) may want to use these classes for QoS queues:
Iptables & ToS & DSCP Values[edit]Iptables and some older routers, notably from Cisco, use an old older ToS scheme defined in RFC 1349 where bits 0 to 2 are "precedence" and 3 to 6 define Type of Service (4 bytes). It lets you use 5 pre-defined ToS named (aliases) to set the ToS byte using its --set-tos option. You can also use hex values 0x00-0xFF or a decimal numbes between 0-255. The names you can use with Iptables are:
You can print the above list with iptables -j TOS -h. Changing the ToS field will also change the Differentiated Services Fields (DS field) since they are the same field. Setting the ToS field to Minimize-Cost will change bit 6. Bit 6 and 7 are are DSCP ECN bits! Be aware of this side-effect when you -j TOS --set-tos using iptables! A precedence of 3 with the Minimize-Cost value will look like this: 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ | | | | | PRECEDENCE | TOS | MBZ | | | | | +-----+-----+-----+-----+-----+-----+-----+-----+ 1 1 0 0 0 0 1 0That's not good since the last two bytes are defined as ECN (Explicit Congestion Notification) bits within the Differentiated services specification. You should avoid using -j TOS --set-tos using the outdated ToS values. However, you can if you really want to, you have our permission: IF=br0 iptables -t mangle -N MYSHAPER-OUT iptables -t mangle -I POSTROUTING -o ${IF} -j MYSHAPER-OUT iptables -t mangle -A MYSHAPER-OUT -p tcp --sport 32680 -j TOS --set-tos Maximize-Throughput iptables -t mangle -A MYSHAPER-OUT -p udp --sport 32680 -j TOS --set-tos Maximize-ThroughputThe above example would mark all traffic from the source-port 32680 going out of br0 as Maximize-Throughput (0x08). iptables can also set the DSCP field. This is what you want to set even if Type-of-service is what you think you want. The DSCP field can be set with either -j DSCP --set-dscp decimal-or-hex-value or -j DSCP --set-dscp-class DiffServ-class-value. See the table below for possible --set-dscp-class values. iptables will accept BE, EF and any of the CSxx and AFxx classes. IF=br0 iptables -t mangle -N MYSHAPER-OUT iptables -t mangle -I POSTROUTING -o ${IF} -j MYSHAPER-OUT iptables -t mangle -A MYSHAPER-OUT -p tcp --sport 32680 -j DSCP --set-dscp-class AF13 iptables -t mangle -A MYSHAPER-OUT -p udp --sport 32680 -j DSCP --set-dscp-class AF13See also[edit]
Enable comment auto-refresher |