Type of Service can be used by applications to indicate priority and Quality of Service for each frame. The level of service is determined by a set of service parameters which provide a three way trade-off between low-delay, high-reliability, and high-throughput. The use of service parameters may increase the cost of service. In many networks, better performance for one of these parameters is coupled with worse performance on another. Except for very unusual cases, at most, two of the parameters should be set.
"IP precedence 使用前3bit; ToS 使用4-7 bit, 最後一位備用;"
"DSCP 使用0-5bit, 最後兩位備用;" For a ToS value, the 8-bit hexadecimal number breaks down as follows:
########################
0 1 2 3 4 5 6 7
+-----+-----+-----+-----+-----+-----+-----+-----+ | | | | | | | | PRECEDENCE | D | T | R | 0 | 0 | | | | | | | | +-----+-----+-----+-----+-----+-----+-----+-----+ #########################
The precedence bits (bits 0-2) break down as follows:
The Network Control precedence designation is intended to be used within a network only. The actual use and control of that designation is up to each network. The Internetwork Control designation is intended for use by gateway originators only.
For a DSCP value, the value represents codepoints for two Differentiated Services (DS) Per-Hop-Behavior (PHB) groups called Expedited Forwarding (EF) and Assured Forwarding (AF). For more information on these PHB groups, refer to RFC 2597 and RFC 2598.
######################################################## 在IP網絡中,IPv4報文中有三種承載QoS優先級標籤的方式,分別爲基於二層的CoS字段(IEEE802.1p)的優先級、基於IP層的IP優先級字段ToS優先級和基於IP層的DSCP(Differentiated Services Codepoint)字段優先級。每種優先級的定義如下:
(1) IEEE802.1p優先級======> 2層Qos(ISL & Dot1Q)
它是位於二層帶標籤的以太網幀的CoS字段,和VLAN ID在一起使用,在字節中的位置如下:
其中:IEEE802.1p優先級:3bit(P2-P0)
未用(CU):1bit VLAN ID:12bit(V11-V0) IEEE802.1p優先級值有8個(0-7),0優先級最低,7優先級最高。報文分爲三種情況:帶優先級和VLAN ID的標籤報文,其優先級值是自身帶的值;只帶優先級的標籤報文,此時VLAN ID爲0,其優先級值是自身帶的值;未帶標籤的報文,一般默認的優先級值爲0,也可以進行更改指定新的優先級。 (2) IP優先級==============》3層IP包頭的服務類型 之一
它由IP分組報頭中的服務類型(ToS)字節中的3位組成,其在字節中的位置如下:
P2 P1 P0 T3 T2 T1 T0 CU
其中:IP優先級:3bit(P2-P0)
服務類型(ToS):4bit(T3-T0) 未用(CU):1bit IP優先級值有8個(0-7),0優先級最低,7優先級最高。在默認情況下,IP優先級6和7用於網絡控制通訊使用,不推薦用戶使用。ToS字段的服務類型未能在現有的IP網絡中普及使用。 (3) DSCP優先級==============》3層IP包頭的服務類型 之二
它由IP分組報頭中的6位組成,使用的是ToS字節,因此在使用DSCP後,該字節也被稱爲DSCP字節。其在字節中的位置如下:
DS5 DS4 DS3 DS2 DS1 DS0 CU CU
其中:DSCP優先級:6bit(DS5-DS0)
未用(CU):2bit DSCP優先級值有64個(0-63),0優先級最低,63優先級最高。事實上DSCP字段是IP優先級字段的超集,DSCP字段的定義向後與IP優先級字段兼容。目前定義的DSCP有默認的DSCP,值爲0;類選擇器DSCP,定義爲向後與IP優先級兼容,值爲(8,16,24,32,40,48,56);加速轉發(EF),一般用於低延遲的服務,推薦值爲46(101110);確定轉發(AF),定義了4個服務等級,每個服務等級有3個下降過程,因此使用了12個DSCP值((10,12,14),(18,20,22),(26,28,30),(34,36,38))。 ############################################# |
IP precedence和DSCP代碼對照表
<0-63> Differentiated services codepoint value
af11 Match packets with AF11 dscp (001010)
af12 Match packets with AF12 dscp (001100)
af13 Match packets with AF13 dscp (001110)
af21 Match packets with AF21 dscp (010010)
af22 Match packets with AF22 dscp (010100)
af23 Match packets with AF23 dscp (010110)
af31 Match packets with AF31 dscp (011010)
af32 Match packets with AF32 dscp (011100)
af33 Match packets with AF33 dscp (011110)
af41 Match packets with AF41 dscp (100010)
af42 Match packets with AF42 dscp (100100)
af43 Match packets with AF43 dscp (100110)
cs1 Match packets with CS1(precedence 1) dscp (001000)
cs2 Match packets with CS2(precedence 2) dscp (010000)
cs3 Match packets with CS3(precedence 3) dscp (011000)
cs4 Match packets with CS4(precedence 4) dscp (100000)
cs5 Match packets with CS5(precedence 5) dscp (101000)
cs6 Match packets with CS6(precedence 6) dscp (110000)
cs7 Match packets with CS7(precedence 7) dscp (111000)
default Match packets with default dscp (000000)
ef Match packets with EF dscp (101110)
Cisco推薦的幾個DSCP值:
路由協議 CS6
交互式語音 EF
交互式視頻 AF41
流式視頻 CS4
電話信令 AF31或CS3
網絡管理 CS2
大塊數據 AF11
盡力服務 0