Книга: Linux Network Administrator Guide, Second Edition
Setting the TOS Bits Using ipfwadm or ipchains
Setting the TOS Bits Using ipfwadm or ipchains
The ipfwadm and ipchains commands deal with the TOS bits in much the same manner. In both cases you specify a rule that matches the datagrams with particular TOS bits set, and use the -t argument to specify the change you wish to make.
The changes are specified using two-bit masks. The first of these bit masks is logically ANDed with the IP options field of the datagram and the second is logically eXclusive-ORd with it. If this sounds complicated, we'll give you the recipes required to enable each of the types of service in a moment.
The bit masks are specified using eight-bit hexadecimal values. Both ipfwadm and ipchains use the same argument syntax:
- t
andmask xormask
Fortunately the same mask arguments can be used each time you wish to set a particular type of service, to save you having to work them out. They are presented with some suggested uses in Table 9.3.
Table 9.3: Suggested Uses for TOS Bitmasks
TOS | ANDmask | XORmask | Suggested Use |
---|---|---|---|
Minimum Delay | 0x01 | 0x10 | ftp, telnet, ssh |
Maximum Throughput | 0x01 | 0x08 | ftp-data, www |
Maximum Reliability | 0x01 | 0x04 | snmp, dns |
Minimum Cost | 0x01 | 0x02 | nntp, smtp |
- 4.4.4 The Dispatcher
- About the author
- Chapter 7. The state machine
- Appendix E. Other resources and links
- Caveats using NAT
- Example NAT machine in theory
- Using Double Quotes to Resolve Variables in Strings with Embedded Spaces
- The final stage of our NAT machine
- Compiling the user-land applications
- The conntrack entries
- Untracked connections and the raw table
- Basics of the iptables command