Howto:The IPv4 TOS field and DiffServ

From innovaphone-wiki

Jump to: navigation, search

Contents

Applies To

This information applies to all innovaphone devices, V5 and V6


More Information

Problem Details

When voice traffic shall be prioritized by routing equipments in the network, it usually needs to be marked as somehow "special", so that the routing equipments knows that it needs to perform prioritization. This is normally done by setting the IP TOS header field to an appropriate value. This article discusses what "appropriate" shall mean.

Background

The innovaphone devices allow you to specify the IP v4 TOS header field value used for media (i.e. voice) traffic. By default, this value is set to 0x10. The configured value directly maps to the the header field. innovaphone devices will not impose any sort of interpretation on this value (except that traffic flowing through one of the PPP interfaces is subject to prioritization if its TOS field exactly matches the configured value). Instead, routing equipment within the network infrastructure is expected to interpret this value.

There is a certain degree of confusion regarding the correct setting of this value. Historically, this is due to several changes in the corresponding RFCs that describe the correct interpretation. RFC 2474 and RFC 2475 define the current understanding. RFC 4594 defines service classes and their intended usage.

RFC 791, RFC 795 and RFC 1349 describe previous and deprecated interpretations.

RFC 4594 defines a number of so-called "DiffServ codepoint (DSCP)" values and also suggest certain DCSPs to be used for certain applications. For VoIP traffic, there are:

Application DSCP Binary Value
Call Signaling CS5 101000
Audio EF 101110
Video AF41 100010

As we (currently [ ckl 18:38, 28 August 2012 (CEST) see Reference9:IP4/General/Settings for v9-related information, Reference:Configuration/IP/Settings for v7/v8 related information ]) only tag RTP traffic with the TOS value configured, EF(Expedited Forwarding) would be an appropriate DSCP. So how does the DSCPs binary value maps to the IP TOS header field then?

RFC 2474says:

  A replacement header field, called the DS field, is defined, which is
  intended to supersede the existing definitions of the IPv4 TOS octet
  [RFC791] and the IPv6 Traffic Class octet [IPv6].
  ...
  Six bits of the DS field are used as a codepoint (DSCP).

So the lower 6 bits of the IPv4 TOS field are used to store the DSCP.

Configuration

At the end of the day, if you want to have RTP traffic sent with e.g. DSCP EF (see above), you would set the TOS field to 0xb8 (DSCP=101110 and ECN=00), as the DS field according to RFC 2475 is put into the IPv4 header TOS octet.

However, always keep in mind that the "good" setting for this value depends on how your routing equipment (which needs to interpret it correctly) interprets it. So, if your routing gear is configured in some way, set the TOS value so that it does what it is supposed to do, regardless of what any RFC says.

V8 and earlier

The default value 0x10 (010000) corresponds DSCP CS2 (OAM). The choice of this default is historical, as it corresponds to the (now deprecated) TOS precedence 0, Normal Delay, High Throughput as per RFC 795. This doesn't make sense nowadays, however, changing it would create desaster when upgrading existing installations, so it stays as it is.

V9 and up

The default value for RTP data is 0xb8 and for signalling 0x68.

Known Problems

Some (especially older) routing equipment will use different terminology, probably derived from older, deprecated RFCs. For example, older Cisco routers use RFC 1349 terminology which says that in the TOS header field, bit 0 to 2 are the "precedence" and 3 to 6 are the "type of service (TOS), which causes a naming conflict with the IP header TOS field.

In this terminology, the precedence is just a 3 bit number, whereas the "type of service" is a 4-bit bit field specifying

1000 minimize delay
0100 maximize throughput
0010 maximize reliability
0001 minimize monetary cost
0000 normal service

Thus, a precedence of 3 with "type of service" minimize delay, maximize throughput would be coded as

 0     1     2     3     4     5     6     7
+-----+-----+-----+-----+-----+-----+-----+-----+
|                 |                       |     |
|   PRECEDENCE    |          TOS          |     |
|                 |                       |     |
+-----+-----+-----+-----+-----+-----+-----+-----+

 1     1     0      1     1     0     0     0

which is 0x1B

Related Articles

Howto:Calculate Values for Type of Service (ToS) from DiffServ or DSCP Values

Howto:Firmware Upgrade V6 V7 and later#Default ToS Values

Howto:Set Type of Service (ToS) DiffServ DSCP Values for innovaphone Windows Applications (SoftwarePhone, myPBX Video)

Reference9:IP4/General/Settings

Reference:Configuration/IP/Settings

Personal tools