Qos Tos Cos Dscp
来源:互联网 发布:淘宝4.6分 编辑:程序博客网 时间:2024/05/16 15:48
QoS/ToS/CoS/DSCP 介绍
由于最近要用到tos,ip precedence和dscp,找了一些资料,现在明白了tos,ipprecedence和dscp这三者的关系。网上流传的版本众多,其实都是正确的,只是分别被不同的标准定义,因而让人莫名其妙。IPPrecedence 和 ToS都位于IP头中,共占一个字节,8bits,关于这几个字节的作用被不同的标准定义过,分别是RFC791,RFC1122,RFC1349;RFC1349废除了之前两个RFC的定义,现在大多设备都使用RFC1349中的定义,所以对于tos,有如下版本,分别说明如下;
下面是RFC1349中的原话:
In the past there has been some confusion about the size of the TOSfield. RFC-791 defined it as a three bit field, including bits 3-5in the figure above. It included bit 6 in the MBZ field. RFC-1122added bits 6 and 7 to the TOS field, eliminating the MBZ field.This
一、RFC1349中的TOS、IPprecedence
RFC1349中定义的ToS格式如下:
+------------+-----------+------------+------------+------------+-----------+-----------+------------+
|
|
|
+------------+-----------+------------+------------+------------+-----------+-----------+------------+
(MBZ:must be zero)
整理成表格为:
PROPERTY
CLIENTVIEWSETTING
BIT MASK/BINARYVALUE
Precedence
ROUTINE(DEFAULT)
000
PRIORITY
001
IMMEDIATE
010
FLASH
011
FLASH OVERRIDE
100
Delay
Normal
Low
0
1
Throughput
Normal
High
0
1
Reliability
Normal
High
0
1
Cost
Normal
Low
0
1
Congestion
N/A
0
二、RFC791中的TOS、IPprecedence
The IP Type of Service Byte:
Bits 0-2: Precedence.
Bit 3: Delay (0 = Normal Delay, 1 = Low Delay)
Bit 4: Throughput (0 = Normal Throughput, 1 = HighThroughput)
Bit 5: Reliability (0 = Normal Reliability, 1 = HighReliability)
Bits 6-7: Reserved for Future Use.
The three bit Precedence field is further defined as follows:
111 - Network Control
110 - Internetwork Control
101 - CRITIC/ECP
100 - Flash Override
011 - Flash
010 - Immediate
001 - Priority
000 - Routine
A. DOD DD173 Precedence/Priority FiledExplanations (Lowest-Highest):
- Routine:(R)
"…is used for allmessages that justify transmission by electrical means unless themessage delivery is of sufficient urgency to require higherprecedence." - Priority: (P)
"…is used for allmessages that require expeditious action by the addressee(s) and/orfurnish essential information for the conduct of ongoingoperations." - Immediate (O)
"…is reserved formessages relating to situations that gravely affect the security ofNational/Allied forces or populace." - Flash(Z)
"…is reserved forinitial enemy contact messages or operational combat messages ofextreme urgency." - FlashOverride (X)
"… is reserved formessages relating to the outbreak of hostilities and/or detonationof nuclear devices." - CRITIC/ECP
"…stands for"Critical and Emergency Call Processing" and should only be usedfor authorized emergency communications, for example in the UnitedStates Government Emergency Telecommunications Service (GETS), theUnited Kingdom Government Telephone Preference Scheme (GTPS) andsimilar government emergency preparedness or reactionaryimplementations elsewhere."
三、RFC1122中的TOS、IPprecedence
“IP PRECEDENCE位前3bits(0-2),ToS为后5bits(3-7),无保留位MBZ。”
The "Type-of-Service" byte in the IP header is divided into twosections: the Precedence field (high-order 3 bits), and a fieldthat is customarily called "Type-of-Service" or "TOS" (low-order 5bits). In this document, all references to "TOS" or the "TOS field"refer to the low-order 5 bits only.
四、由RFC2474定义的DSCP
RFC2474 定义最高3比特为级别/类别选择代码(Class SelectorCodepoints,CS),其意义和IPv4报头中IP优先级的定义是相同的,CS0 ~ CS7的级别相等于IP优先级0 ~7。但它并没有定义第3到第5比特的具体含义以及使用规则。
DSCP使用6比特,可以定义64个优先级(0-63)。AF保证转发(Assured Forwarding,AF)由RFC2597对CS1~CS4进行进一步定义。它使用第3和第4比特做丢弃优先级标志。01-低丢弃优先级;10-中丢弃优先级;11-高丢弃优先级。这样,在同一类数据中,又根据被丢弃的可能性划分出3档。
BinaryDecimal
CS0000 00000CS1001 00081AF11001 010101AF12001 100121AF13001 110141CS2010 000162AF21010 010182AF22010 100202AF23010 110222CS3011 000243AF31011 010263AF32011 100283AF33
d>011 110303CS4100 000324AF41100 010344AF42100 100364AF43100 110384CS5101 000405EF101 110465CS6110 000486CS7111 000567
==========================================================================================
严格的说,Cos与Tos只是QoS的一种标记机制。
QoS范围太大,涉及到入口数据流的标记和分类及速率限制,网络骨干的拥塞避免和拥塞管理,网络出口的队列调度机制等等。
Cos是二层ISL或者802.1Q数据帧的优先级标记,3个bit,范围0-7;
Tos是三层数据包的服务类型标记,也是3个bit,范围0-7,同样可当作优先级标记,另外5个实际指示Delay,Throughput,Reliability等特性的bit位一般没有使用;现在为了更好的控制数据流分类,使用DSCP(DifferentialServices Code Point),扩展了Tos的后三个bit,因此,范围从0-63。
在实施QoS策略时,Cos与ToS或DSCP之间通常要做映射机制。
TOS: