[Note] QoS learning note === ###### tags: `note` `QoS` `CoS` `DSCP` [toc] # Introduction QoS is Quality of Service through methods like 1. Bandwidth 1. Software Queue 1. Packet Delay 1. Packet Drop There are two direction os QoS including 1. Integrated Services (IntServ) 2. Differentiated Services (DiffServ) **Differentiated Services** (**DiffServ**) is the mainstream. # Integrated Services (IntServ) - Reserve bandwidth for particular packets in advance. - It is a static method. ![](https://i.imgur.com/ePXBSxk.png) # Differentiated Services (DiffServ) - Traffic controls will be initiated only when congestion occurs. - It is a dynamic method, but it is more complicated to set up. - Per-hop Behavior (PHB) - Classification & Marking ![](https://i.imgur.com/Mynxj8n.png) # Hardware Queue & Software Queue - The size of both Ingress and Egress Interface hardware queue are adjustable. - It is not recommandable to adjust the size of ingress interface hardware queue. - **Tail Drop** means packets are dropped while hardware queue is overflow. ![](https://i.imgur.com/cu5aClr.png) ## Software Queuing (Scheduling) - When tail drop occurs, it is important to check the priority of packets, and put them into egress hardware queue. ![](https://i.imgur.com/g6J7T6a.png) # Classification & Marking - The priority of packets can be recorded in field Type of Service (ToS) in IP header. - When receiving packets, launch classification first, and then doing marking. - **Marking** means writting values of IPP or DSCP into ToS field according to their priorities. ![](https://i.imgur.com/nRFhHO2.png) ## IP Procedence (IPP) - IPP utilizes the first 3 bits of ToS as below table. |IPP Name| IPP Binary| IPP Decimal| RFC Classification| Example| |:-:|:-:|:-:|:-:|:-:| |Routine |000 |0 |Best Effort Data| FTP, File Transfer |Priority |001 |1 |Medium Priority Data| 企業內中度重要性 Application |Immediate |010 |2 |High Priority Data| 企業內高度重要性 Application |Flash |011 |3 |Call Control/Signaling| RTSP |Flash Override |100 |4 |Video| RTP |Critical |101 |5 |VoIP| RTP |Internetwork Control |110 |6 |Internetworking/Routing| OSPF, EIGRP |Network Control |111 |7 |Reserved| Reserved ## Differentiated Services Code Point (DSCP) - DSCP utilizes the first 6 bits of ToS. - The first 3 bits stand for the importance. - In the perspective of DSCP, there are no remarkable difference on **Assured Forwarding** (AF??). - But if a software queueing system does not support DSCP, the difference is trival. - In general, AF4? is more important than AF1?. - The forth and fifth bits represent **drop preferences** of packets. - Packets with bigger drop preference will be dropped first. - AF12 will be dropped before AF11. - Bit 6 is reserved and remains 0. - AFxy = (8 * x) + (2 * y) ![](https://i.imgur.com/mJ5kna7.png) # Software Queuing - Weighted Fair Queuing (WFQ) - Class-based Weighted Fair Queueing (CBWFQ) # Reference https://www.jannet.hk/zh-Hant/post/quality-of-service-qos-router/