Configuration Guide
QoS Configuration Guide
30 min
introduction introduction qos (quality of service) is a technology that addresses issues such as network latency and congestion as a security mechanism in the network, qos can provide better service capabilities to improve service quality in normal circumstances, if the network is only used for specific time insensitive applications, such as web applications or email setups, qos may not be necessary however, for critical applications and multimedia applications, qos becomes particularly important during network overload or congestion, qos ensures that important business traffic is not affected by delays or losses while ensuring the efficient operation of the network explanation of principles explanation of principles priority mapping priority mapping networks typically face various types of traffic, each with different performance and service requirements therefore, to meet the needs of different applications and services and ensure the performance of critical applications while improving the overall network performance, users can use different qos priorities in different networks this involves mapping the priority carried by the packet to the local priority processed by the device, providing differentiated qos services based on the local priority the priority carried by the packet is called packet priority, for example vlan packets use 802 1p, and ip packets use dscp the local priority, also known as tc (traffic class), corresponds to the eight queues at the egress by default differentiated services for packets of different priorities are implemented based on the scheduling methods of different egress queues queue scheduling queue scheduling queue scheduling algorithms are one of the core mechanisms for implementing network qos control and an important part of network resource management it controls the use of link bandwidth by different types of packets to provide different levels of service to different data streams each interface of the device in the outbound direction is configured with 8 queues they are identified by queue ids from 0 to 7 packets are assigned to different egress queues based on the mapping from local priority to egress queues, and then processed according to the configured queue scheduling method strict scheduling strict priority scheduling the scheduling is strictly based on the priority of the egress queue, and only when the high priority queue is empty will the low priority queue be scheduled users can put high priority business packets into high priority queues and non critical business packets into low priority queues to ensure that high priority business can be scheduled first during congestion, ensuring business stability the priority scheduling order for queues is queue7> queue6> queue5> queue4> queue3> queue2> queue1> queue0 it is worth noting that this scheduling method may cause packets in low priority queues to be scheduled late, leading to queue starvation dwrr scheduling weighted round robin scheduling queues are scheduled in a round robin manner according to their weights the device supports a mixed scheduling mode of strict and dwrr for different queues under the same interface queues configured with strict scheduling mode are given priority when there are no packets in queues scheduled by the strict mode, queues are scheduled according to the weights in the dwrr mode by default, the scheduling mode for queues is dwrr, with a weight of 100 for each queue traffic shaping traffic shaping when the transmission rate of packets exceeds the reception rate, or when the downstream device interface speed is lower than that of the upstream device, it can lead to network congestion without restricting the size of user generated traffic, a continuous burst of business data from numerous users can further congest the network to ensure that limited network resources are effectively utilized to serve users, it's necessary to impose limits on user generated traffic typically, traffic specifications are evaluated using token buckets a token bucket can be envisioned as a container that holds a certain number of tokens the device deposits tokens into the bucket at a predetermined rate when the bucket is full, any excess tokens overflow, and no more tokens are added to the bucket the token bucket is merely a method for measuring traffic and does not filter or take any action on the traffic, such as discarding packets; these operations are performed by other functionalities qos priority configuration qos priority configuration true 277,117 79132610222928,266 2086738977707#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type configuring priority mapping relationship configuring priority mapping relationship by default, the mapping from the dscp/802 1p priority carried in the packet to the local priority is as follows all mapped to priority 0 the mapping from local priority to the egress queue is as follows tc 0—queue 0, tc 1—queue 1, tc 2—queue 2, tc 3—queue 3, tc 4—queue 4, tc 5—queue 5, tc 6—queue 6, tc 7—queue 7 164,189 93650793650792,307 06349206349205#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type binding priority mapping relationship binding priority mapping relationship true 220,208,233#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type qos queue scheduling configuration qos queue scheduling configuration the device supports a hybrid scheduling mode of strict and dwrr for different queues under the same interface queues configured with strict mode for priority scheduling are given priority, and when there are no packets in the strict mode queues, dwrr queues are scheduled according to their weights by default, the scheduling mode for queues is dwrr, with weights all set to 1 204,311 5578231292517,145 4421768707483#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type traffic shaping configuration traffic shaping configuration true 236,119 27372699278598,305 726273007214#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type configuring traffic shaping based on interface configuring traffic shaping based on interface 162,138 93424036281178,360 0657596371882#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type configuring queue rate limiting configuring queue rate limiting 174,232 71675336801385,254 28324663198615#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type configuring traffic shaping based on flows configuring traffic shaping based on flows true 401,144 70223176990095,115 29776823009905#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type creating a traffic behavior creating a traffic behavior true 286,220 07482993197277,154 92517006802723#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type configuring a car template configuring a car template single bucket single rate (sbsr) mode is a traffic control mechanism that uses a token bucket to regulate the forwarding rate of packets, aiming to control the average rate of traffic to ensure that the traffic on the network does not exceed a specific rate limit when evaluating traffic, the parameters of the token bucket include cir (committed information rate) the rate at which tokens are added to the token bucket, default unit is kbps cbs (committed burst size) the capacity of the token bucket, default unit is bytes, representing the size of the burst that can be accommodated by the token bucket in single bucket single rate mode, when the device receives a packet, it compares the number of tokens in the bucket if there are enough tokens, the packet is forwarded if there are not enough tokens, the packet is either dropped or buffered let tc represent the number of tokens in the bucket, and tc is initialized to cbs if the length of the packet does not exceed the number of tokens tc in the bucket, the packet is marked as green, and tc is decremented by the size of the packet (tc = tc b) if the length of the packet exceeds the number of tokens tc in the bucket, the packet is marked as red, and tc remains unchanged dual token bucket dual rate (tbdr) mode uses two token buckets to control packet transmission, each defining the "cbs (committed burst size)" and "pbs (peak burst size)" respectively cir committed information rate, expressed in default units of kbps, represents the rate at which tokens are added to the c bucket cbs committed burst size, expressed in default units of bytes, represents the maximum amount of data that can be transmitted from the c bucket pir peak information rate, expressed in default units of kbps, represents the rate at which tokens are added to the p bucket pir is greater than cir pbs peak burst size, expressed in default units of bytes, represents the maximum amount of data that can be transmitted from the p bucket token addition method tokens are added to the c and p buckets at rates of cir and pir respectively since these two token buckets are independent, if one bucket runs out of tokens, incoming packets to that bucket will be discarded while the other bucket remains unaffected and continues to receive tokens tc and tp represent the token counts in the c and p buckets respectively, with both initialized to cbs and pbs if the length of the packet exceeds the token count in the p bucket (tp), the packet is marked as red, and tc and tp remain unchanged if the length of the packet is greater than tc but less than tp, the packet is marked as yellow, and tp is decreased by the token count (b) while tc remains unchanged if the length of the packet does not exceed the token count in the c bucket (tc), the packet is marked as green, and both tp and tc are decreased by the token count (b) the dual token bucket dual rate (tbdr) mode allows for more granular control over different types of traffic, enabling marking and management based on rate requirements and congestion conditions it facilitates the implementation of more sophisticated qos policies to ensure that different traffic classes receive appropriate treatment, thereby maintaining network stability and service quality 177,202 45124716553286,281 5487528344671#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type binding traffic behavior binding traffic behavior by configuring a car (committed access rate) template and binding it with an acl (access control list), users can finely control which traffic needs to be rate limited this approach helps in managing bandwidth usage for specific types or sources of traffic, preventing certain flows from excessively consuming network resources and thereby balancing the overall network utilization true 272,252 95064457353047,136 04935542646953#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type it is also possible to bind the car template directly to the port true 182,258 5088641517213,220 4911358482787#4283c7 unhandled content type #4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type display and maintenance display and maintenance 332,329#4283c7 unhandled content type #4283c7 unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type #d8e5f5 unhandled content type #d8e5f5 unhandled content type unhandled content type unhandled content type priority mapping and queue scheduling configuration example priority mapping and queue scheduling configuration example network requirement in a certain data center network structure as shown in the diagram below, there are three types of traffic accessing the internet http, ftp, and email, with corresponding dscp values of 33, 35, and 27 the current requirement is to configure the packet transmission priorities on the device as follows http > ftp > email in case of congestion, ensure the priority transmission of http packets http data must be transmitted first before sending other data, and the ratio of ftp to email traffic should be controlled at 2 1 procedure 1 assign ip addresses to interfaces for network access 2 configure dscp to priority mapping sonic(config)# qos map dscp to tc profile1 33 4 sonic(config)# qos map dscp to tc profile1 35 3 sonic(config)# qos map dscp to tc profile1 27 2 sonic(config)# interface ethernet 1 sonic(config if 1)# qos map bind dscp to tc profile1 3 configure mapping from local priority to egress queue sonic(config)# qos map tc to queue test 0 0 sonic(config)# qos map tc to queue test 1 1 sonic(config)# qos map tc to queue test 2 2 sonic(config)# qos map tc to queue test 3 3 sonic(config)# qos map tc to queue test 4 4 sonic(config)# qos map tc to queue test 5 5 sonic(config)# qos map tc to queue test 6 6 sonic(config)# qos map tc to queue test 7 7 sonic(config)# qos map all bind tc to queue 4 configure dwrr scheduling on ethernet1 sonic(config)# interface ethernet 1 sonic(config if 1)# uc tx queue scheduler 4 mode strict sonic(config if 1)# uc tx queue scheduler 3 mode dwrr weight 2 sonic(config if 1)# uc tx queue scheduler 2 mode dwrr weight 1 verify configuration 1 view configuration sonic# show qos map dscp to tc { "profile1" { "27" "2", "33" "4", "35" "3" } } sonic# show interface qos map bind { "ethernet1" { "dscp to tc map" "\[dscp to tc map|profile1]" } } sonic# show interface uc tx queue { "ethernet1|4" { "scheduler|scheduler ethernet1 2" { "type" "strict" } } "ethernet1|3" { "scheduler|scheduler ethernet1 3" { "type" "dwrr" } } "ethernet1|2" { "scheduler|scheduler ethernet1 4" { "type" "dwrr" } } } when congestion occurs, queue4 should be prioritized, and there should be no packet drops in queue4 this means that the packets from the http traffic (dscp 33) in queue4 should be serviced without any drops traffic shaping configuration example traffic shaping configuration example network requirements a data center network structure is shown below, the services from the network side of the network are data, voice and video, carrying 802 1p priorities of 2, 3 and 4 respectively bandwidth jitter may occur because the traffic rate on the ingress side of the device is greater than the rate on the egress side to reduce bandwidth jitter while ensuring bandwidth requirements for various services, it is required that device egress bandwidth is limited to 1000mbit/s; data bandwidth limited to 200mbit/s; voice bandwidth is limited to 300mbit/s; video bandwidth limited to 500mbit/s; procedure 1 configure each interface ip to enable users to access the network through the device 2 configure priority mapping for dot1p to tc sonic(config)# qos map dot1p to tc profile1 2 2 sonic(config)# qos map dot1p to tc profile1 3 3 sonic(config)# qos map dot1p to tc profile1 4 4 sonic(config)# interface ethernet 1 sonic(config if 1)# qos map bind dot1p to tc profile1 3 configure port traffic shaping on ethernet1 of the device, set pir=12500000 byte/s, pbs=1280000 byte sonic(config)# interface ethernet 1 sonic(config if 1)# port shaper enable 12500000 1280000 4 configure queue traffic shaping policies sonic(config)# interface ethernet 1 sonic(config if 1)# uc tx queue scheduler 2 mode strict sonic(config if 1)# uc tx queue scheduler 2 pir 200000000 sonic(config if 1)# uc tx queue scheduler 3 mode strict sonic(config if 1)# uc tx queue scheduler 3 pir 300000000 sonic(config if 1)# uc tx queue scheduler 4 mode strict sonic(config if 1)# uc tx queue scheduler 4 pir 500000000 verify configuration 1 configuration verification sonic# show qos map dot1p to tc sonic# show interface qos map bind sonic# show interface port shaper 2 streaming verification after successful configuration, check the port count through the command show interfaces counters and check the queue reception through the command show queue counters 1 on the device, both meet the requirements
