IP PRECEDENCE / TOS / DSCP
2010.11.02
# IP PRECEDENCE / ToS
First of all, IP Precedence 和 ToS都位于IP头中,共占一个字节,8bits, 关于这几个字节的作用被不同的标准定义过,分别是RFC791,RFC1122,RFC1349; RFC1349废除了之前两个RFC的定义,现在大多设备都使用RFC1349中的定义;
下面是RFC1349中的原话:
In the past there has been some confusion about the size of the TOS
field. RFC-791 defined it as a three bit field, including bits 3-5
in the figure above. It included bit 6 in the MBZ field. RFC-1122
added bits 6 and 7 to the TOS field, eliminating the MBZ field. This
memo redefines the TOS field to be the four bits shown in the figure
above.
先说最新的RFC1349种的定义:
“IP PRECEDENCE 位前3bits(0-2),ToS为后4bits(3-6),最后1bit为保留MBZ。”
The TOS facility is one of the features of the Type of Service octet
in the IP datagram header. The Type of Service octet consists of
three fields:
The first field, labeled "PRECEDENCE" above, is intended to denote
the importance or priority of the datagram. This field is not
discussed in detail in this memo.
The second field, labeled "TOS" above, denotes how the network should
make tradeoffs between throughput, delay, reliability, and cost. The
TOS field is the primary topic of this memo.
The last field, labeled "MBZ" (for "must be zero") above, is
currently unused. The originator of a datagram sets this field to
zero (unless participating in an Internet protocol experiment which
makes use of that bit). Routers and recipients of datagrams ignore
the value of this field. This field is copied on fragmentation.
RFC791定义:
“IP PRECEDENCE 位前3bits(0-2),ToS为后3bits(3-5),最后2bit为保留MBZ。”
An independent measure of the importance of this
datagram.
Bits 0-2: Precedence.
Bit 3: 0 = Normal Delay, 1 = Low Delay.
Bits 4: 0 = Normal Throughput, 1 = High Throughput.
Bits 5: 0 = Normal Relibility, 1 = High Relibility.
Bit 6-7: Reserved for Future Use.
Precedence
111 - Network Control
110 - Internetwork Control
101 - CRITIC/ECP
100 - Flash Override
011 - Flash
010 - Immediate
001 - Priority
000 - Routine
RFC1122定义:
“IP PRECEDENCE 位前3bits(0-2),ToS为后5bits(3-7),无保留位MBZ。”
The "Type-of-Service" byte in the IP header is divided into
two sections: the Precedence field (high-order 3 bits), and
a field that is customarily called "Type-of-Service" or
"TOS" (low-order 5 bits). In this document, all references
to "TOS" or the "TOS field" refer to the low-order 5 bits
only.
# DSCP
"DSCP 使用0-5bit, 最后两位备用;"
Recommended codepoints for the four general use AF classes are given
below. These codepoints do not overlap with any other general use PHB
groups.
The RECOMMENDED values of the AF codepoints are as follows: AF11 = ’
001010’, AF12 = ’001100’, AF13 = ’001110’, AF21 = ’010010’, AF22 = ’
010100’, AF23 = ’010110’, AF31 = ’011010’, AF32 = ’011100’, AF33 = ’
011110’, AF41 = ’100010’, AF42 = ’100100’, and AF43 = ’100110’. The
table below summarizes the recommended AF codepoint values.