Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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 Jun 26 '13 at 9:18
    
I could not find any resource which says about tos valid values. –  Hamed JML Jun 26 '13 at 9:23
    
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 Jun 26 '13 at 9:24
    
I want to know what are valid values for tos filed in iptables –  Hamed JML Jun 26 '13 at 9:32

1 Answer 1

up vote 2 down vote accepted

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.