Книга: Linux Network Administrator Guide, Second Edition

Setting the TOS Bits Using iptables

Setting the TOS Bits Using iptables

The iptables tool allows you to specify rules that capture only datagrams with TOS bits matching some predetermined value using the -m tos option, and for setting the TOS bits of IP datagrams matching a rule using the -j TOS target. You may set TOS bits only on the FORWARD and OUTPUT chains. The matching and the setting occur quite independently. You can configure all sort of interesting rules. For example, you can configure a rule that discads all datagrams with certain TOS bit combinations, or a rule that sets the TOS bits of datagrams only from certain hosts. Most often you will use rules that contain both matching and setting to perform TOS bit translations, just as you could for ipfwadm or ipchains.

Rather than the complicated two-mask configuration of ipfwadm and ipchains, iptables uses the simpler approach of plainly specifying what the TOS bits should match, or to what the TOS bits should be set. Additionally, rather than having to remember and use the hexadecimal value, you may specify the TOS bits using the more friendly mnemonics listed in the upcoming table.

The general syntax used to match TOS bits looks like:

- m tos -tos mnemonic [other-args] -j target

The general syntax used to set TOS bits looks like:

[other-args] -j TOS -set mnemonic

Remember that these would typically be used together, but they can be used quite independently if you have a configuration that requires it.

Mnemonic Hexadecimal
Normal-Service 0x00
Minimize-Cost 0x02
Maximize-Reliability 0x04
Maximize-Throughput 0x08
Minimize-Delay 0x10

Оглавление книги


Генерация: 2.862. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз