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.