Valid Type Of Service Values

1

I need to know what are valid values for TOS field in iptables.

I mean when I try to add a rule with ip rule add what can I give as tos value

I could not find any resource about tos value. I know what it is, but what are valid values for tos in linux and specially with iptables.

Thanks

Hamed JML

Posted 2013-06-26T09:15:58.357

Reputation: 387

Hello Hamed, please [edit] your question and add more detail. What you would add to a rule is dependent on what you want to achieve. If you want to just understand, then there are plenty of resources on the internet you can use for research. – Paul – 2013-06-26T09:18:25.957

I could not find any resource which says about tos valid values. – Hamed JML – 2013-06-26T09:23:03.323

The TOS parameter is an 8 bit number expressed as a hexidecimal, and matches the TOS field in a packet. So any number from 0-255 is valid. – Paul – 2013-06-26T09:24:50.910

I want to know what are valid values for tos filed in iptables – Hamed JML – 2013-06-26T09:32:43.083

Answers

2

Essentially, it depends what you want to achieve. Most systems do not honor TOS as part of their forwarding/processing decision. If you do have a system that does honor it, then it is probably documented there.

However, RFC 1349 originally specified the use of the TOS field, which was not really used. It was later obsoleted by RFC 2474, which defines the top 6 bits of that byte to include a Differentiated Services Code Point (the lower two bits are used by ECN). A good overview over the typical values can be found in Wikipedia. So typical values for the higher 6 bits are:

  • 0x00 (Default)
  • 0x0a, 0x0c, 0x0e; 0x12, 0x14, 0x16; 0x1a, 0x1c, 0x1e; 0x22, 0x24, 0x26 (the twelve different Assured Forwarding behaviors)
  • 0x2c (Voice Admit)
  • 0x2e (Expedited Forwarding)

To use these values, multiply them by 4 and add the appropriate ECN value to it or just use the --set-dscp option to the iptables command.

Setting TOS/DSCP does not directly affect your traffic's treatment, unless the routers are configured to act on these bits, which mostly means you need to talk to your ISP (and probably pay some money).

Marcel Waldvogel

Posted 2013-06-26T09:15:58.357

Reputation: 401