Three different models exist for addressing QoS on a network. The best-effort model was designed for best-effort, no-guarantee delivery of packets and is still the predominant model in the internet today. The Integrated Services (IntServ) model was introduced to supplement the best-effort delivery by setting aside some bandwidth for applications that require bandwidth and delay guarantees. IntServ expects applications to signal their requirements to the network. The Differentiated Services (DiffServ) model was added to provide greater scalability in providing QoS to IP packets.
網路上有三種不同的模型可用來處理 QoS。盡力服務(best-effort)模型是為了盡力、不保證的封包遞送而設計,至今仍是網際網路上最主流的模型。整合服務(Integrated Services,IntServ)模型的推出是為了補充盡力服務遞送,為需要頻寬與延遲保證的應用程式保留部分頻寬。IntServ 要求應用程式向網路發出訊號告知其需求。差異化服務(Differentiated Services,DiffServ)模型則是為了在提供 IP 封包 QoS 時提供更高的可擴充性而加入。
In a best-effort model, QoS is not applied to traffic, and packets are serviced in the order they are received with no preferential treatment. If it is not important when or how packets arrive, or if there is no need to differentiate between traffic flows, the best-effort model is appropriate.
在盡力服務模型中,流量不會套用 QoS,封包會依收到的順序處理,沒有優先待遇。如果封包何時或如何抵達並不重要,或不需要區分不同流量,盡力服務模型就是合適的選擇。
The IntServ model provides guaranteed QoS to IP packets. Applications signal to the network that they will require special QoS for a period of time and that bandwidth is reserved across the network. With IntServ, packet delivery is guaranteed; however, the use of this model can limit the scalability of the network.
IntServ 模型為 IP 封包提供有保證的 QoS。應用程式會向網路發出訊號,表示在某段時間內需要特殊的 QoS,並在整個網路中保留頻寬。使用 IntServ,封包遞送是有保證的;但這種模型的使用可能會限制網路的可擴充性。
The DiffServ model provides scalability and flexibility in implementing QoS in a network. Network devices recognize traffic classes and provide different levels of QoS to different traffic classes.
DiffServ 模型在網路中實作 QoS 時提供可擴充性與彈性。網路裝置會辨識流量類別,並為不同流量類別提供不同等級的 QoS。
Differentiated Services Model
差異化服務模型
DiffServ is a multiple-service model for implementing QoS in the network. With DiffServ, the network tries to deliver a particular kind of service that is based on the QoS that is specified by each packet. This specification can occur in different ways, such as using DSCP or source and destination addresses in IP packets. The network uses the QoS specification of each packet to classify, shape, and police traffic and to perform intelligent queuing.
DiffServ 是網路中實作 QoS 的一種多重服務模型。使用 DiffServ 時,網路會嘗試根據每個封包所指定的 QoS 提供特定種類的服務。此規格可以用不同方式表示,例如使用 DSCP 或 IP 封包中的來源與目的地位址。網路會使用每個封包的 QoS 規格來分類、整形、管制流量,並執行智慧型佇列。
DiffServ was designed to overcome the limitations of both the best-effort and IntServ models. DiffServ can provide an "almost guaranteed" QoS while still being cost-effective and scalable.
DiffServ 的設計目的是克服盡力服務與 IntServ 兩種模型的限制。DiffServ 可以在維持成本效益與可擴充性的同時,提供「近乎保證」的 QoS。
DiffServ has these major benefits:
DiffServ 有以下主要優點:
- It is highly scalable.高度可擴充。
- It provides many different levels of quality.提供多種不同等級的品質。
DiffServ also has these drawbacks:
DiffServ 也有以下缺點:
- No absolute guarantee of service quality can be made.無法絕對保證服務品質。
- It requires a set of complex mechanisms to work in concert throughout the network.需要一整套複雜機制在整個網路中協同運作。
With the DiffServ model, QoS mechanisms are used without prior signaling, and QoS characteristics (for example, bandwidth and delay) are managed on a hop-by-hop basis with policies that are established independently at each device in the network. This approach is not considered an end-to-end QoS strategy because end-to-end guarantees cannot be enforced. However, DiffServ is a more scalable approach to implementing QoS because hundreds or potentially thousands of applications can be mapped into a small set of classes upon which similar sets of QoS behaviors are implemented. Although QoS mechanisms in this approach are enforced and applied on a hop-by-hop basis, uniformly applying global meaning to each traffic class provides both flexibility and scalability.
在 DiffServ 模型中,QoS 機制的使用不需要事先發出訊號,QoS 特性(例如頻寬與延遲)是以逐跳方式管理,各裝置在網路中各自獨立建立政策。這種方式不算是端對端的 QoS 策略,因為無法強制保證端對端的服務品質。不過,DiffServ 是實作 QoS 較具可擴充性的方式,因為數百甚至數千種應用程式可以對應到少數幾個類別,並對這些類別套用相似的 QoS 行為。雖然這種方式中的 QoS 機制是逐跳強制套用,但對每個流量類別統一套用全域意義,能同時提供彈性與可擴充性。
With DiffServ, network traffic is divided into classes that are based on business requirements. Each of the classes can then be assigned a different level of service. As the packets traverse a network, each of the network devices identifies the packet class and services the packet according to this class. You can choose many levels of service with DiffServ. For example, voice traffic from IP phones is usually given preferential treatment over all other application traffic. Email is generally given best-effort service. Nonbusiness, or scavenger, traffic can either be given very poor service or blocked entirely.
使用 DiffServ 時,網路流量會依據業務需求分成多個類別,接著每個類別可以指派不同等級的服務。封包在網路中傳遞時,每部網路裝置會辨識封包所屬的類別,並依此類別提供服務。DiffServ 可以選擇多種服務等級。舉例來說,來自 IP 電話的語音流量通常會比其他所有應用程式流量獲得優先待遇。電子郵件通常只獲得盡力服務。非業務性、也就是清道夫(scavenger)流量,可以獲得非常差的服務或完全被封鎖。
DiffServ works like a package delivery service. You request (and pay for) a level of service when you send your package. Throughout the package network, the level of service is recognized and your package is given either preferential or normal service, depending on what you requested.
DiffServ 的運作方式就像包裹遞送服務。您在寄送包裹時要求(並付費)某個服務等級。在整個包裹遞送網路中,該服務等級會被識別,您的包裹會依您所要求的等級獲得優先或一般服務。
DiffServ Terminology
DiffServ 術語
Key DiffServ terminology is used to describe the DiffServ mechanisms.
了解 DiffServ 機制需要用到一些關鍵的 DiffServ 術語。
To understand the DiffServ model, you must understand DiffServ terminology:
要了解 DiffServ 模型,您必須先了解 DiffServ 術語:
- BA: A collection of packets with the same DSCP value crossing a link in a particular direction. Packets from multiple applications and sources can belong to the same BA.BA:指在特定方向上通過某鏈路、DSCP 值相同的一組封包。來自多個應用程式與來源的封包可以屬於同一個 BA。
- DSCP: A value in the IP header that is used to select a QoS treatment for a packet. In the DiffServ model, classification and QoS revolve around the DSCP.DSCP:IP 標頭中用來為封包選擇 QoS 處理方式的一個數值。在 DiffServ 模型中,分類與 QoS 都是圍繞 DSCP 進行。
- PHB:An externally observable forwarding behavior (or QoS treatment) that is applied at a DiffServ-compliant node to a DiffServ BA. The term PHB refers to the packet scheduling, queuing, policing, or shaping behavior of a node on any given packet belonging to a BA. The DiffServ model itself does not specify how PHBs must be implemented. A variety of techniques may be used to affect the desired traffic conditioning and PHB. In Cisco IOS Software, you can configure PHBs by using Modular QoS CLI (MQC) policy maps.PHB:在符合 DiffServ 規範的節點上,對某個 DiffServ BA 套用、可從外部觀察到的轉送行為(或 QoS 處理方式)。PHB 一詞是指節點對屬於某個 BA 的任何封包所執行的封包排程、佇列、管制或整形行為。DiffServ 模型本身並未指定 PHB 該如何實作。可以使用多種技術來達成所需的流量調節與 PHB。在 Cisco IOS 軟體中,您可以使用模組化 QoS CLI(MQC)政策映射(policy map)來設定 PHB。
The DiffServ architecture is based on a simple model in which traffic entering a network is classified at the boundaries of the network. The traffic class is then marked, using a DSCP marking in the IP header. Packets with the same DSCP markings create BAs as they traverse the network in a particular direction, and these aggregates are forwarded according to the PHB that is associated with the DSCP marking.
DiffServ 架構是以一個簡單的模型為基礎:進入網路的流量會在網路邊界進行分類。接著使用 IP 標頭中的 DSCP 標記來標記該流量類別。具有相同 DSCP 標記的封包在特定方向上通過網路時會形成 BA,這些聚合會依據與該 DSCP 標記相關聯的 PHB 進行轉送。
Each DSCP value identifies a BA. Each BA is assigned a PHB. Each PHB is implemented using the appropriate QoS mechanism or set of QoS mechanisms.
每個 DSCP 值都對應一個 BA。每個 BA 會指派一個 PHB。每個 PHB 都是使用適當的 QoS 機制或一組 QoS 機制來實作。
One of the primary principles of DiffServ is that you should mark packets as close to the edge of the network as possible. It is often a difficult and time-consuming task to determine the traffic class for a data packet, and you should classify the data as few times as possible. By marking the traffic at the network edge, core network devices and other devices along the forwarding path will be able to quickly determine the proper QoS treatment to apply to a given traffic flow, based on the PHB that is associated with the DSCP marking.
DiffServ 的其中一項主要原則是應盡可能在靠近網路邊緣的地方標記封包。判斷資料封包的流量類別通常是一項困難且耗時的工作,因此應盡量減少對資料進行分類的次數。在網路邊緣標記流量後,核心網路裝置及轉送路徑上的其他裝置就能根據與該 DSCP 標記相關聯的 PHB,快速判斷應對特定流量套用何種 QoS 處理方式。
Per-Hop Behaviors
逐跳行為
Different PHBs are used in a network, based on the DSCP of the IP packets.
網路中會依據 IP 封包的 DSCP 使用不同的 PHB。
The table describes the PHBs that are defined by IETF standards.
下表說明由 IETF 標準所定義的 PHB。
PHB PHB | Use 用途 | DSCP Bit Settings DSCP 位元設定 |
Default 預設 | Used for best-effort service 用於盡力服務 | Bits 7 through 5 of DSCP = 000 DSCP 第 7 至 5 位元 = 000 |
EF EF | Used for low-delay service 用於低延遲服務 | Bits 7 through 5 of DSCP = 101 DSCP 第 7 至 5 位元 = 101 |
AF AF | Used for guaranteed bandwidth service 用於保證頻寬服務 | Bits 7 through 5 of DSCP = 001, 010, 011, or 100 DSCP 第 7 至 5 位元 = 001、010、011 或 100 |
Class selector 類別選擇器 | Used for backward compatibility with non-DiffServ-compliant devices (RFC 1812 devices) 用於與不符合 DiffServ 規範的裝置(RFC 1812 裝置)維持向下相容 | Bits 4 through 2 of DSCP = 000 DSCP 第 4 至 2 位元 = 000 |
The default PHB essentially specifies that a packet marked with a DSCP value of 000000 (recommended) receives the traditional best-effort service.
預設 PHB 基本上是指標記為 DSCP 值 000000(建議值)的封包會獲得傳統的盡力服務。
The EF PHB is intended to provide a guaranteed bandwidth rate with the lowest possible delay. This is achieved by providing prioritized forwarding for the EF PHB. Due to the prioritized forwarding, this PHB polices excess bandwidth so that other classes that are not using this PHB are not starved for bandwidth. Applications such as VoIP, video, and online trading programs require this kind of robust service.
EF PHB 旨在以最低可能延遲提供有保證的頻寬速率,這是透過對 EF PHB 提供優先轉送來達成。由於採用優先轉送,此 PHB 會管制超額頻寬,以免未使用此 PHB 的其他類別因頻寬不足而挨餓。VoIP、視訊及線上交易程式等應用程式都需要這種強健的服務。
The AF PHB provides a mechanism to provide different levels of forwarding assurances. Each level should be treated independently and should have allocated bandwidth that is based on the QoS policy. An AF implementation must detect and respond to long-term congestion within each class by dropping packets while handling short-term congestion (packet bursts) by queuing packets. This implies the presence of a smoothing or filtering function that monitors the instantaneous congestion level and computes a smoothed congestion level. The dropping algorithm uses this smoothed congestion level to determine when packets should be discarded.
AF PHB 提供一種機制,可提供不同等級的轉送保證。每個等級應獨立處理,並應依 QoS 政策分配頻寬。AF 實作必須偵測並回應每個類別中的長期壅塞(做法是丟棄封包),同時處理短期壅塞(封包突增)(做法是將封包排入佇列)。這代表其中存在一種平滑或過濾功能,可監控即時壅塞程度並計算平滑後的壅塞程度。丟棄演算法會使用這個平滑後的壅塞程度來決定何時應丟棄封包。
Class selector DSCPs are values that are backward compatible with IP precedence. When converting between IP precedence and DSCP, match the three most significant bits. Packets with higher IP precedence should be (on average) forwarded in less time than packets with lower IP precedence.
類別選擇器 DSCP 是與 IP 優先權向下相容的數值。在 IP 優先權與 DSCP 之間轉換時,需比對最高的三個位元。IP 優先權較高的封包平均而言應在較短時間內被轉送,優先於 IP 優先權較低的封包。
Expedited Forwarding
加速轉送
The EF PHB provides a mechanism to offer guaranteed bandwidth with the lowest delay.
EF PHB 提供一種機制,可以最低延遲提供有保證的頻寬。
The EF PHB is intended to provide a guaranteed bandwidth rate with the lowest possible delay. This is achieved by providing prioritized forwarding for the EF PHB. Due to the prioritized forwarding, this PHB polices excess bandwidth so that other classes that are not using this PHB are not starved for bandwidth. Strict priority queuing is typically used for EF traffic.
EF PHB 旨在以最低可能延遲提供有保證的頻寬速率,這是透過對 EF PHB 提供優先轉送來達成。由於採用優先轉送,此 PHB 會管制超額頻寬,以免未使用此 PHB 的其他類別因頻寬不足而挨餓。EF 流量通常採用嚴格優先佇列。
Packets requiring EF PHB should be marked with a DSCP binary value of 101110, or decimal 46. Non-DiffServ-compliant devices will regard the EF DSCP value as IP precedence 5. This precedence is the highest user-definable IP precedence and is typically used for delay-sensitive traffic such as VoIP.
需要 EF PHB 的封包應標記為 DSCP 二進位值 101110,即十進位 46。不符合 DiffServ 規範的裝置會將 EF DSCP 值視為 IP 優先權 5。這是可由使用者定義的最高 IP 優先權,通常用於對延遲敏感的流量,例如 VoIP。
Assured Forwarding
保證轉送
The AF PHB provides a mechanism to provide different levels of forwarding assurances.
AF PHB 提供一種機制,可提供不同等級的轉送保證。
The AF PHB defines a method by which BAs can be given different forwarding assurances. There are four standard defined AF classes that are represented by the aaa values of 001, 010, 011, and 100. Each class should be treated independently and should have allocated bandwidth that is based on the QoS policy.
AF PHB 定義了一種方法,可為 BA 提供不同的轉送保證。有四個標準定義的 AF 類別,分別以 aaa 值 001、010、011 及 100 表示。每個類別應獨立處理,並應依 QoS 政策分配頻寬。
Traffic in different classes is usually given a proportional measure of priority. If congestion occurs between classes, the traffic in the higher class is given priority. Also, instead of using strict PQ, more balanced queue servicing algorithms are implemented (fair queuing or Weighted Fair Queuing). If congestion occurs within a class, the packets with the higher drop probability are discarded first. Typically sophisticated drop selection algorithms like RED are used to avoid tail drop issues.
不同類別的流量通常會獲得成比例的優先待遇。若類別之間發生壅塞,較高類別的流量會優先處理。此外,這種方式不使用嚴格優先佇列(PQ),而是實作較為平衡的佇列服務演算法(公平佇列或加權公平佇列)。若在某一類別內發生壅塞,丟棄機率較高的封包會優先被丟棄。通常會使用像 RED 這類複雜的丟棄選擇演算法,以避免尾端丟棄(tail drop)問題。
Class Selector
類別選擇器
The class selector provides interoperability between DSCP-based and IP precedence-based devices in a network.
類別選擇器提供網路中以 DSCP 為基礎與以 IP 優先權為基礎的裝置之間的互通性。
The meaning of the eight bits in the DS field of the IP packet has changed over time to meet the expanding requirements of IP networks.
IP 封包 DS 欄位中八個位元的意義隨著時間演變,以因應不斷擴大的 IP 網路需求。
Originally, the DS field was referred to as the ToS field, and the first three bits of the field (bits 5 to 7) defined a packet IP precedence value. A packet could be assigned one of six priorities based on the IP precedence value (eight total values minus two reserved values). IP precedence 5 (101) was the highest priority that could be assigned (RFC 791).
最初,DS 欄位稱為 ToS 欄位,該欄位的前三個位元(第 5 至 7 位元)定義封包的 IP 優先權值。封包可依 IP 優先權值指派六種優先等級之一(共八種數值,扣除兩個保留值)。IP 優先權 5(101)是可指派的最高優先等級(RFC 791)。
RFC 2474 replaced the ToS field with the DS field, where a range of eight values (class selector) is used for backward compatibility with IP precedence. There is no compatibility with other bits that are used by the ToS field.
RFC 2474 以 DS 欄位取代 ToS 欄位,其中使用八個值的範圍(類別選擇器)來與 IP 優先權維持向下相容。與 ToS 欄位使用的其他位元則不相容。
The class-selector PHB was defined to provide backward compatibility for DSCP with ToS-based IP precedence. RFC 1812 simply prioritizes packets according to the precedence value. The PHB is defined as the probability of timely forwarding. Packets with higher IP precedence should be (on average) forwarded in less time than packets with lower IP precedence.
類別選擇器 PHB 的定義目的是為 DSCP 與以 ToS 為基礎的 IP 優先權提供向下相容性。RFC 1812 只是單純依優先權值為封包排定優先順序。此 PHB 定義為及時轉送的機率。IP 優先權較高的封包平均而言應在較短時間內被轉送,優先於 IP 優先權較低的封包。
The last three bits of the DSCP (bits 2 to 4), set to 0, identify a class-selector PHB. You can calculate the DSCP value for a CS PHB by multiplying the class number by 8. For example, the DSCP value for CS3 would be equal to (3 * 8) = 24.
DSCP 的最後三個位元(第 2 至 4 位元)設為 0,即代表類別選擇器 PHB。您可以將類別編號乘以 8 來計算 CS PHB 的 DSCP 值。例如,CS3 的 DSCP 值等於(3 * 8)= 24。



