QoS: ToS vs. DSCP
封包的 QoS(Quality of Service) 表示該封包的品質,品質越好,表示有越低的延遲、掉包、…,作法是利用封包 header 的特定欄位值,來表示此封包 的優先等級。
此欄位定義在 網路架構 第三層(Internet Protocol) header 的欄位中,長度為 8 bits,在 IPv4 和 IPv6 的 header 中的位置不同。
在 IPv4 Header 此欄位稱為: DSCP / ToS
在 IPv6 Header 此欄位稱為: Traffic Class
此欄位的解讀方式有兩種,擇一使用:
ToS (Type of Service)
DSCP (Differentiated Service Code Point)
ToS (Type of Service)
ToS (Type of Service),細分成 Precedence 及 ToS 欄位
| Precedence(3) | ToS(4) | Unused(1) |
Precedence (RFC-1112) – 值越高,優先權越高
| 111 | Network Control |
| 110 | Internetwork Control |
| 101 | Critic/ECP |
| 100 | Flash Override |
| 011 | Flash |
| 010 | Immediate |
| 001 | Priority |
| 000 | Routine |
ToS (RFC-1349) – 值越大,優先權越高。這些值的組合是沒有意義的,分別獨立。
| 1000 | Minimize Delay |
| 0100 | Maximize Throughput |
| 0010 | Maximize Reliability |
| 0001 | Minimize Monetary Cost |
| 0000 | Normal Service(Default) |
Type of Service 最早定義在 RFC-791。之後的 RFC-2474 則改變了這些區域的代表意義,稱作 DS (Differentiated Services)。
ToS 因為定義問題,使得支援性比較低,實際網路上都是用 DS,因此在 IPv6 階段,ToS 已經不支援了。
Differentiated Services Code Point
Differentiated Services Code Point(DSCP, RFC-2474) 細分的話,分成 Class Selector、Drop Precedence 及 Explicit Congestion Notification (ECN)欄位
| Class Selector(3) | Drop Precedence(3) | ECN(2) |
Class selector values (3)
| DSCP | Binary | Hex | Decimal | Typical application | Examples |
|---|---|---|---|---|---|
| CS0 (Default) | 000 | 0x00 | 0 | ||
| CS1 | 001 | 0x08 | 8 | Scavenger | YouTube, Gaming, P2P |
| CS2 | 010 | 0x10 | 16 | OAM | SNMP, SSH, Syslog |
| CS3 | 011 | 0x18 | 24 | Signaling | SCCP, SIP, H.323 |
| CS4 | 100 | 0x20 | 32 | Realtime | TelePresence |
| CS5 | 101 | 0x28 | 40 | Broadcast video | Cisco IPVS |
| CS6 | 110 | 0x30 | 48 | Network control | EIGRP, OSPF, HSRP, IKE |
| CS7 | 111 | 0x38 | 56 |
Drop Precedence value (3)
| Drop Precedence | Binary | Hex | Decimal |
|---|---|---|---|
| Undefined | 000 | 0x00 | 0 |
| Low | 010 | 0x02 | 2 |
| Medium | 100 | 0x04 | 4 |
| Heigh | 110 | 0x06 | 6 |
常用的 DSCP 值
| DSCP value | Hex value | Decimal value | Meaning | Drop probability | Equivalent IP precedence value |
|---|---|---|---|---|---|
| 101 110 | 0x2e | 46 | Expedited forwarding (EF) | N/A | 101 Critical |
| 000 000 | 0x00 | 0 | Best effort | N/A | 000 - Routine |
| 001 010 | 0x0a | 10 | AF11 | Low | 001 - Priority |
| 001 100 | 0x0c | 12 | AF12 | Medium | 001 - Priority |
| 001 110 | 0x0e | 14 | AF13 | High | 001 - Priority |
| 010 010 | 0x12 | 18 | AF21 | Low | 010 - Immediate |
| 010 100 | 0x14 | 20 | AF22 | Medium | 010 - Immediate |
| 010 110 | 0x16 | 22 | AF23 | High | 010 - Immediate |
| 011 010 | 0x1a | 26 | AF31 | Low | 011 - Flash |
| 011 100 | 0x1c | 28 | AF32 | Medium | 011 - Flash |
| 011 110 | 0x1e | 30 | AF33 | High | 011 - Flash |
| 100 010 | 0x22 | 34 | AF41 | Low | 100 - Flash override |
| 100 100 | 0x24 | 36 | AF42 | Medium | 100 - Flash override |
| 100 110 | 0x26 | 38 | AF43 | High | 100 - Flash override |
Reference
QoS封包原理簡單介紹
wiki: Type of service
wiki: IPv4
wiki: IPv6 Packet
文字內容 或 影像內容 部份參考、引用自網路,如有侵權,請告知,謝謝。
