<<

QoS provides differentiated service qualities for different applications, for example, dedicated bandwidth, decreased ratio, short packet transmission delay, and decreased delay and jitter. Best-effort service model  Routers and switches are packet switching devices. They select transmission path for each packet based on TCP/IP and use the statistics multiplexing method, but do not use the dedicated connections like TDM. Traditionally, IP provides only one service model (Best-Effort). In this model, all packets transmitted on a network have the same priority. Best-Effort means that the IP network tries best to transmit all packets to the correct destination addresses completely and ensure that the packets are not discarded, damaged, repeated, or loss of sequence during transmission. However, the Best-Effort model does not guarantee any transmission indicators, such as delay and jitter.  Best-Effort is not belongs to the QOS technical in strict, but is the major service model used by today's . So we need know about it.  Due to the Best-Effort model, the Internet has made a lot of achievements. However, with the development of the Internet, the Best-Effort model cannot meet increasing requirements of emerging applications. Therefore, the SPs have to provide more types of service based on the Best-Effort model, to meet requirements of each application. IntServ model  The IntServ model, developed by IETF in 1993, supports various types of service on IP networks. It provides both real-time service and best-effort service on IP networks. The IntServ model reserves resources for each information flow. The source and destination hosts exchange RSVP messages to establish packet categories and forwarding status on each node along the transmission path. The model maintains a forwarding state for each flow, so it has a poor extensibility. There are millions of flows on the Internet, which consume a large number of device resources. Therefore, this model is not widely used. In recent years, IETF has modified the RSVP protocol, and defines that RSVP can be used together with the DiffServ model, especially in the MPLS VPN field. Therefore, RSVP has a new improvement. However, this model still has not been widely used. THe DiffServ model addresses problems in the IntServ mode, so the DiffServ model is a widely used QoS technology. DiffServ model  The IntServ has a poor extensibility. After 1995, SPs and research organizations developed a new mechanism that supports various services. This mechanism has a high extensibility. In 1997, IETF recognized that the service model in use is not applicable to network operation, and there should be a way to classify information flows and provide differentiated service for users and applications. Therefore, IETF developed the DiffServ model, which classifies flow on the Internet and provides differentiated service for them. The DiffServ model supports various applications and is applicable to many business models. Precedence field  The 8-bit Type of Service (ToS) field in an IP packet header contains a 3-bit IP precedence field.  Bits 0 to 2 constitute the Precedence field, representing precedence values 7, 6, 5, 4, 3, 2, 1 and 0 in descending order of priority. The highest priorities (values 7 and 6) are reserved for routing and network control communication updates. User-level applications can use only priority values 0 to 5. Bits 6 and 7 are reserved.  Apart from the Precedence field, a ToS field also contains the D, T, and R sub-fields: • Bit D indicates the delay. The value 0 represents a normal delay and the value 1 represents a short delay. • Bit T indicates the throughput. The value 0 represents normal throughput and the value 1 represents high throughput. • Bit R indicates the reliability. The value 0 represents normal reliability and the value 1 represents high reliability. DSCP field  RFC 2474 redefines the TOS field. The right-most 6 bits identify service type and the left-most 2 bits are reserved. DSCP can classify traffic into 64 categories.  Each DSCP value matches a Behavior Aggregate (BA) and each BA matches a PHB (such as forward and discard), and then the PHB is implemented using some QoS mechanisms (such as traffic policing and queuing technologies).  DiffServ network defines four types of PHB: Expedited Forwarding (EF), Assured Forwarding (AF), Class Selector (CS), and Default PHB (BE PHB). EF PHB is applicable to the services that have high requirements on delay, packet loss, jitter, and bandwidth. AF PHBs are classified into four categories and each AF PHB category has three discard priorities to specifically classify services. The performance of AF PHB is lower than the performance of EF PHB. CS PHBs originate from IP TOS, and are classified into 8 categories. BE PHB is a special type in CS PHB, and does not provide any guarantee. Traffic on IP networks belongs to this category by default. Priority mapping configuration  Configure the trusted packet priorities: Run the trust command to specify the packet priority to be mapped.  Configure the priority mapping table: Run the qos map-table command to enter the 802.1p or DSCP mapping table view, and run the input command to set the priority mappings. Token bucket  A token bucket with a certain capacity stores tokens. The system places tokens into a token bucket at the configured rate. When the token bucket is full, excess tokens overflow and no token is added.  A token bucket forwards packets according to the number of tokens in the token bucket. If there are sufficient tokens in the token bucket for forwarding packets, the traffic rate is within the rate limit. Otherwise, the traffic rate is not within the rate limit.

Single-rate-single-bucket  A token bucket is called bucket C. Tc indicates the number of tokens in the bucket. Single-rate-single-bucket has two parameters: • Committed Information Rate (CIR): indicates the rate of putting tokens into bucket C, that is, the average traffic rate permitted by bucket C. • Committed Burst Size (CBS): indicates the capacity of bucket C, that is, the maximum volume of burst traffic allowed by bucket C each time.  The system places tokens into the bucket at the CIR. If Tc is smaller than the CBS, Tc increases; otherwise, Tc does not increase.  B indicates the size of an arriving packet: • If B is smaller than or equal to Tc, the packet is colored green, and Tc decreases by B. • If B is greater than Tc, the packet is colored red, and Tc remains unchanged. Single-Rate-Double-Bucket  Two token buckets are available: bucket C and bucket E. Tc and Te indicate the number of tokens in the bucket. Single-rate-double-bucket has three parameters: • Committed Information Rate (CIR): indicates the rate of putting tokens into bucket C, that is, the average traffic rate permitted by bucket C. • Committed Burst Size (CBS): indicates the capacity of bucket C, that is, the maximum volume of burst traffic allowed by bucket C each time. • Excess Burst Size (EBS): indicates the capacity of bucket E, that is, the maximum volume of excess burst traffic allowed by bucket E each time.  The system places tokens into the buckets at the CIR: • If Tc is smaller than the CBS, Tc increases. • If Tc is equal to the CBS and Te is smaller than the EBS, Te increases. • If Tc is equal to the CBS and Te is equal to the EBS, Tc and Te do not increase.  B indicates the size of an arriving packet: • If B is smaller than or equal to Tc, the packet is colored green, and Tc decreases by B. • If B is greater than Tc and smaller than or equal to Te, the packet is colored yellow and Te decreases by B. • If B is greater than Te, the packet is colored red, and Tc and Te remain unchanged. Double-Rate-Double-Bucket  Two token buckets are available: bucket P and bucket C. Tp and Tc indicate the number of tokens in the bucket. Double-rate-double-bucket has four parameters: • Peak information rate (PIR): indicates the rate at which tokens are put into bucket P, that is, the maximum traffic rate permitted by bucket P. The PIR must be greater than the CIR. • Committed Information Rate (CIR): indicates the rate of putting tokens into bucket C, that is, the average traffic rate permitted by bucket C. • Peak Burst Size (PBS): indicates the capacity of bucket P, that is, the maximum volume of burst traffic allowed by bucket P each time. PBS is greater than CBS. • Committed Burst Size (CBS): indicates the capacity of bucket C, that is, the maximum volume of burst traffic allowed by bucket C each time.  The system places tokens into bucket P at the rate of PIR and places tokens into bucket C at the rate of CIR: • If Tp is smaller than the PBS, Tp increases. If Tp is greater than or equal to the PBS, Tp remains unchanged. • If Tc is smaller than the CBS, Tc increases. If Tc is greater than or equal to the CBS, Tc remains unchanged.  B indicates the size of an arriving packet: • If B is greater than Tp, the packet is colored red. • If B is greater than Tc and smaller than or equal to Tp, the packet is colored yellow and Tp decreases by B. • If B is smaller than or equal to Tc, the packet is colored green, and Tp and Tc decrease by B. Traffic policing discards excess traffic to limit traffic within a proper range and to protect network resources and enterprises' interests. Traffic policing consists of:  Meter: measures the network traffic using the token bucket mechanism and sends the measurement result to the marker.  Marker: colors packets in green, yellow, or red based on the measurement result received from the meter.  Action: takes actions based on packet coloring results (packets in green or yellow are forwarded and packets in red are discarded by default) received from the marker. The following actions are defined: • Pass: forwards the packets that meet network requirements. • Remark + pass: changes the local priorities of packets and forwards them. • Discard: discards the packets that do not meet network requirements. If the rate of a type of traffic exceeds the threshold, the device lowers the packet priority and then forwards or directly discards the packets. By default, these packets are discarded. Traffic policing commands:  Configure interface-based traffic policing: Run the qos car command to create a QoS CAR profile and configure QoS CAR parameters. The parameters in the command vary when the command is executed on a WAN interface and a LAN interface.  Configure rate limiting on WAN interface: Run the qos lr command to set the ratio of packet rate sent by a physical interface to the total interface bandwidth. Traffic policing discards excess traffic to limit traffic within a proper range and to protect network resources and enterprises' interests. process:  When packets arrive, the device classifies packets into different types and places them into different queues.  If the queue that packets enter is not configured with traffic shaping, the packets are immediately sent. Packets requiring queuing proceed to the next step.  The system places tokens to the bucket at the specified rate (CIR): • If there are sufficient tokens in the bucket, the device forwards the packets and the number of tokens decreases. • If there are insufficient tokens in the bucket, the device places the packets into the buffer queue. When the buffer queue is full, packets are discarded.  When there are packets in the buffer queue, the system extracts the packets from the queue and sends them periodically. Each time the system sends a packet, it compares the number of packets with the number of tokens till the tokens are insufficient to send packets or all the packets are sent. Traffic shaping commands:  Configure interface-based traffic shaping: Run the qos gts command to configure traffic shaping on the interface.  Configure queue-based traffic shaping. • Run the qos queue-profile queue-profile-name command to create a queue profile and display the queue profile view. • Run the queue { start-queue-index [ to end-queue-index ] } &<1-10> length { bytes bytes-value | packets packets- value } command to set the length of each queue. • Run the queue { start-queue-index [ to end-queue-index ] } &<1-10> gts cir cir-value [ cbs cbs-value ] command to configure queue-based traffic shaping. By default, traffic shaping is not performed for queues. • Run the qos queue-profile queue-profile-name command to apply the queue profile to an interface. If the rate of incoming packets on an interface is higher than the rate of outgoing packets, the interface is congested. If there is insufficient space for storing the packets, some packets are discarded. When packets are discarded, hosts or routers retransmit the packets, leading to a vicious circle. When congestion occurs, multiple packets preempt resources. The packets that cannot obtain resources are discarded. The bandwidth, delay, and jitter of key services cannot be ensured. The core of congestion management is to decide the resource scheduling policy that specifies the packet forwarding sequence. Generally, devices use the queue technology to cope with congestion. The queue technology involves queue creation, traffic classifier, and queue scheduling. Initially, there is only one queue scheduling policy, that is, First-in-First-out. To meet different service requirements, more scheduling policies are developed. Queue scheduling mechanisms include hardware queue scheduling and software queue scheduling. Hardware queue is also called transmit queue (TxQ). The interface drive uses this queue when transmiting packets one by one. The hardware queue is a FIFO queue. Software queue schedules data packets to hardware queue according to QoS requirements. It can use multiple scheduling methods. Data packets enter the software queue only when the hardware queue is full. The hardware queue length depends on the bandwidth setting on the interface. If the interface bandwidth is high, transmission delay is short, so queue length can be long. An appropriate hardware queue length is important. If the hardware queue length is too long, the policy execution performance of the software queue degrades because the hardware queue uses the FIFO mechanism for scheduling. If the hardware queue length is too short, scheduling efficiency is low, link use efficiency is low, and the CPU usage is high. LAN ports support the FQ and WRR queues. WAN ports support the FQ and WFQ queues. Configuration commands:  Run the qos queue-profile queue-profile-name command to create a queue profile and display the queue profile view.  On the WAN-side interface, run the schedule{ { pq start-queue-index [ to end-queue- index ] } | {wfq start-queue-index [ to end-queue-index ] } command to set a scheduling mode for each queue on the WAN-side interface.  On the LAN-side interface, run the schedule{ { pq start-queue-index [ to end-queue- index ] } | { drr start-queue-index [ to end-queue-index ] } | {wrr start-queue-index [ to end-queue-index ] } command to set a scheduling mode for each queue on the LAN- side interface.  Run the qos queue-profile queue-profile-name command to apply the queue profile to an interface. FIFP characteristics:  Advantages: • Simple  Disadvantages: • Unfair and no separation between flows. A large flow will occupy the bandwidth of other flows, which prolongs the delay of other flows. • When congestion occurs, FIFO discards some packets. When TCP detects packet loss, it lowers transmission speed to avoid congestion. However, UDP does not lower transmission speed because it is a connectionless protocol. As a result, the TCP and UDP packets in FIFO are not equally processed. The TCP packet rate is too low. • A flow may occupy all the buffer space and blocks other types of traffic. RR  Advantages: • Different flows are separated, and bandwidth is equally allocated to queues. • Available bandwidth is equally allocated to other queues.  Disadvantages: • Weights cannot be configured for the queues. • When queues have different packet lengths, scheduling is inaccurate. • When scheduling rate is low, delay and jitter indicators will deteriorate. For example, when a packet arrives at an empty queue that is just scheduled, this packet can be processed only when all the other queues are scheduled. In this situation, jitter is serious. However, if scheduling rate is high, the delay is short. The RR mode is widely used on high-speed routers. Compared with RR, WRR can set the weights of queues. During the WRR scheduling, the scheduling chance obtained by a queue is in direct proportion to the weight of the queue. During the WRR scheduling, the empty queue is directly skipped. Therefore, when there is a small volume of traffic in a queue, the remaining bandwidth of the queue is used by the queues according to a certain proportion.  Advantages: • Bandwidth is allocated based on weights, and the remaining bandwidth of a queue is equally allocated to other queues. Low-priority queues are also scheduled in a timely manner. • It is easy to implement. • Applicable to DiffServ ports.  Disadvantages: • Similar to RR, WRR is inaccurate when queues have different packet lengths. • When scheduling rate is low, packet delay is unstable and the delay and jitter indicators cannot be lowered to the expected values. PQ  PQ has four-level queues, including Top, Middle, Normal, and Bottom. However, most devices support eight-level queues. Packets in queues with a low priority can be scheduled only after all packets in queues with a high priority have been scheduled. Therefore, PQ has obvious advantages and disadvantages.  PQ ensures that the packets in high-priority queues obtain high bandwidth, low delay and jitter; however, the packets in low-priority queues cannot be scheduled in a timely manner or even cannot be scheduled. As a result, the lower-priority queues starve out.  PQ has the following characteristics: • Uses ACL to classify packets into different types and adds packets to the corresponding queues. • Packets are discarded only by using the Tail Drop mechanism. • When the queue length is set to 0, the queue length can be infinite. That is, the packets entering this queue are not discarded by Tail Drop unless the memory space is exhausted. • The FIFO logic is used internal the queue. • The packets in low-priority queues are scheduled only after all packets in high-priority queues are scheduled.  PQ ensures high quality for specified service traffic, but does not care about the quality of other services.  Advantages: • Precisely controls the delay of high-priority queues. • Easy to implement, differentiating services  Disadvantages: • Cannot allocate bandwidth as required. When high-priority queues have many packets, the packets in low-priority queues cannot be scheduled. • It shortens the delay of high-priority queues by compromising the service quality of low-priority queues. • If a high-priority queue transmits TCP packets and a low-priority queue transmits UDP packets, the TCP packets are transmitted at a high speed, while UDP packets cannot obtain sufficient bandwidth. CQ  The number of bytes to be scheduled must be specified for each queue. A packet can be scheduled only when its length exceeds the specified byte size. If the configured byte size is too small, the queue may be congested. If the configured byte size is small, bandwidth allocation is inaccurate. For example, 500 bytes is specified for a queue, while most packets in the queue exceed 1000 bytes. Therefore, the bandwidth actually allocated is higher than the expected bandwidth. If the number of bytes specified is large, it is difficult to control the delay. CQ can schedule multiple packets each time. The number of packets to be scheduled is the same as the number of packets that can be accommodated by the bytes scheduled each time.  Advantages: • Allocates bandwidth according to certain percentages. When the traffic volume of a queue is small, other queues can occupy the bandwidth of this queue. • Easy to implement  Disadvantages: • When the specified number of bytes is small, bandwidth allocation is inaccurate. When the specified number of bytes is large, delay and jitter are serious. WFQ  Weighted (WFQ) classifies packets by flow. On an IP network, the packets with the same source IP addresses, destination IP addresses, protocol numbers, and IP precedence belong to the same flow. On an MPLS network, the packets with the same labels and EXP fields belong to the same flow. WFQ assigns each flow to a queue, and tries to assign different flows to different flows. When packets leave the queues, WFQ allocates the bandwidth on the outbound interface for each flow according to the weights. The smaller the weight value of the flow is, the smaller the bandwidth the flow obtains. The greater the weight value of the flow is, the greater the bandwidth the flow obtains. In this manner, services of the same priority are treated equally; services of different priorities are allocated with different weight.  For example, there are eight flows on the interface, with weights as 1, 2, 3, 4, 5, 6, 7, and 8 respectively. The total bandwidth quota is the sum of weights, that is, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36. The bandwidth occupied by each flow is: Weight of each flow/Total bandwidth quota. That is, flows obtain the bandwidth of 1/36, 2/36, 3/36, 4/36, 5/36, 6/36, 7/36, and 8/36. Thus, WFQ assigns different scheduling weights to services of different priorities while ensuring fairness between services of the same priority.  Advantages:  The queues are scheduled fairly based on the granularity of bytes.  Differentiates services and allocates weights.  Properly controls delay and reduces jitter.  Disadvantages:  Difficult to implement. Congestion Avoidance  Tail drop is a traditional method in the congestion avoidance mechanism. When the length of a queue reaches the maximum value, all the packets are discarded. If too many TCP packets are dropped, TCP times out. This may result in slow TCP start and trigger the congestion avoidance mechanism so that the device slows down the transmission of TCP packets. When queues drop several TCP-connection packets at the same time, these TCP connections start congestion avoidance and slow startup, which is referred to as global TCP synchronization. Thus, these TCP connections simultaneously send fewer packets to the queue so that the rate of incoming packets is smaller than the rate of outgoing packets, reducing the bandwidth usage. Moreover, the volume of traffic sent to the queue varies greatly from time to time. As a result, the volume of traffic over the link fluctuates between the bottom and the peak. The delay and jitter of certain traffic are affected.  The traditional packet loss policy uses the tail drop method. When the queue length reaches the upper limit, the excess packets (buffered at the queue tail) are discarded.  To prevent global TCP synchronization, Random Early Detection (RED) is used. The RED technique randomly discards packets to prevent the transmission speed of multiple TCP connections from being reduced simultaneously. The TCP rate and network traffic volume thus are stable.  The device provides Weighted Random Early Detection (WRED) based on RED technology. WRED discards packets in queues based on DSCP field or IP precedence. The upper drop threshold, lower drop threshold, and drop probability can be set for each priority. When the number of packets of a priority reaches the lower drop threshold, the device starts to discard packets. When the number of packets reaches the upper drop threshold, the device discards all the packets. A higher threshold indicates a high drop probability. The maximum drop probability cannot exceed the upper drop threshold. WRED discards packets in queues based on the drop probability, thereby relieving congestion.  WRED configuration: • Configure a drop profile. • Run the drop-profile drop-profile-name command to create a drop profile and enter the drop profile view. • Run the dscp{ dscp-value1 [ to dscp-value2 ] } &<1-10> low-limit low- limit-percentage high-limit high-limit-percentage discard-percentage discard-percentage command to set DSCP-based WRED parameters. • Run the ip-precedence { ip-precedence-value1 [ to ip-precedence- value2 ] } &<1-10> low-limit low-limit-percentage high-limit high-limit- percentage discard-percentage discard-percentage command to set IP precedence-based WRED parameters. • Apply the drop profile. • Run the qos queue-profile queue-profile-name command to enter the queue profile view. • Run the schedule wfq start-queue-index [ to end-queue-index ] command to set the scheduling mode of a queue to WFQ. • Run the queue { start-queue-index [ to end-queue-index ] } &<1–10> drop- profile drop-profile-name command to bind a drop profile to a queue in a queue profile. • Run the qos queue-profile queue-profile-name command to apply the queue profile to an interface. Traffic classification is used to identify the packets with certain characteristics according to a rule, and is the prerequisite and basis for differentiated services. You can define rules to classify packets and specify the relationships between rules:  AND: Packets match a traffic classifier only when the packets match all the rules. If a traffic classifier contains ACL rules, packets match the traffic classifier only when the packets match one ACL rule and all the non-ACL rules. If a traffic classifier does not contain ACL rules, packets match the traffic classifier only when the packets match all the non-ACL rules.  OR: Packets match a traffic classifier as long as the packets match a rule. A traffic behavior refers to an action taken for packets. Performing traffic classification is to provide differentiated services. A traffic classifier takes effect only when it is associated with a traffic control action or a resource allocation action. A traffic policy is configured by binding traffic classifiers to traffic behaviors. After a traffic policy is applied to an interface, globally, to a board, or to a VLAN, differentiated service is provided. Traffic policy configuration commands  Configure a traffic classifier. • Run the traffic classifier classifier-name [ operator { and | or } ] command to create a traffic classifier and enter the traffic classifier view.  Configure a traffic behavior. • Run the traffic behavior behavior-name command to create a traffic behavior and enter the traffic behavior view.  Configure a traffic policy. • Run the traffic policy policy-name command to create a traffic policy and enter the traffic policy view. • The classifier behavior command binds a traffic behavior to a traffic classifier to a traffic behavior in a traffic policy.  Run the traffic-policy policy-name { inbound | outbound } command to apply a traffic policy to the interface or sub-interface in the inbound or outbound direction.