1. QoS based on Cisco routers

Source: Internet
Author: User

1. QoS model

Best Effort Service model (Best-effort)

Integration Service Model (Integrated services)

Differential service model (differentiated services)


2. Differential service model structure


3. Classification and marking

Tags can be marked with the high three-bit (IP priority) or high six-bit (DSCP) of the TOS in the IP header.


On R1, the priority of ICMP traffic is set to 2, the DSCP value of the HTTP traffic is set to AF22, the other unmatched traffic priority is set to 1, and the token is viewed on the ISP.


The ISP configuration is as follows:


IP HTTP Server

Access-list permit IP any any DSCP af22

Access-list permit IP any precedence 1

Access-list permit IP any precedence 2

Interface fastethernet2/0

Service-policy input MARK


The R1 configuration is as follows:

Access-list permit ICMP any any

Access-list permit tcp any any EQ www


Class-map Match-all ICMP

Match Access-group 110

Class-map Match-all WWW

Match Access-group 120


Policy-map MARK

Class ICMP

Set Precedence 2

Class WWW

Set DSCP af22

Class Class-default

Set Precedence 1

Interface fastethernet2/0

Service-policy input MARK


Testing command on test

Ping 33.1.1.1

Telnet 33.1.1.1 80


View commands

Show IP access-lists

Show Class-map

Show Policy-map

Show Policy-map Interface S0/1



4. Queue technology (congestion management)

Queue technology is applied to the direction of the interface, and an interface can use only one queue technology.

There is a software queue and a hardware queue on the router's interface. The packet enters the soft queue first, and then the packet is dispatched into the hardware queue using the queue technology, and the hardware queue always sends the packet in first in, out-of-the-way.

Common queuing Technologies: FIFO, PQ, CQ, WFQ, llq are CLI tools, and CBWFQ are MQC tools.

First in, out queue (FIFO)

Priority Queue (PQ)

Custom Team (CQ)

Weighted Fair Queue (WFQ)

Low latency Queue (LLQ)

Real-time transmission queue (RTP PQ):

Class-weighted Fair queueing (CBWFQ)


Queue Technology Three components: Classification component, insert drop component, dispatch component


First in, out queue (FIFO)

By default: When the interface speed is greater than 2.048Mbps, the router is scheduled with a FIFO.


Priority Queue (PQ)

Number of queues: high, Medium, normal, low a total of 4 queues

Classification: Placing different queues according to pre-classification

Insert Discard: The queue length can be set, and after the queue is full, the packet will be discarded by tail

Scheduling: According to High, medium, Normal, low order scheduling, only the high priority queue is empty to schedule the priority, and so on.

Advantages: High priority packet forwarding is guaranteed

Disadvantage: High-priority queues are not empty, and low-priority queues are never forwarded


Specifies the queue that does not conform to any type of packet that will enter (default normal)

Priority-list 1 Default High

Classify and place a packet into a queue based on the ingress of the packet

Priority-list 1 Interface Serial 0/0 high

Classify and place a packet into a queue based on the protocol type of the packet

Priority-list 1 Protocol IP High TCP telnet

Specify the size of each queue

Priority-list 1 queue-limit 10 10 10 10

Apply a queue on an interface

Priority-group 1


=================================================================

R1

=================================================================

Priority-list 1 Interface fastethernet2/0 High

Priority-list 1 Protocol IP normal TCP www

Priority-list 1 Default Low

Priority-list 1 Queue-limit 10 20 30 40


Interface SERIAL0/1

Priority-group 1


viewing queues on an interface

Show int S0/1

View Queue Configuration

Show Queueing priority

Test queue is in effect

Debug priority

Show Queueing Interface S0/1


Custom Queue (CQ)

Number of queues: CQ has 17 queues, where queue 0 is the priority queue. Only queue 0 is empty for the other queue service.

Classification: Placing different queues according to pre-classification

Insert Discard: The queue length can be set, and after the queue is full, the packet will be discarded by tail

Dispatch: After a packet of a certain number of bytes is forwarded for the 1th queue, it is forwarded to the 2nd queue, followed by polling

Pros: Ensure every queue has the opportunity to be serviced


Specifies the queue that does not conform to any type of packet that will enter (default queue 1)

Queue-list 1 Default 1

Classify and place a packet into a queue based on the ingress of the packet

Queue-list 1 Interface Serial 0/0 1

Classify and place a packet into a queue based on the protocol type of the packet

Queue-list 1 Protocol IP 1 TCP telnet

Specify the number of packet bytes that each queue is forwarded at each polling

Queue-list 1 Queue 1 byte-count 100

Specify the size of each queue

Queue-list 1 Queue 1 limit 100

Specify a priority queue (for example, 2 at this time, queue 0 and 1 are priority queues)

Queue-list 1 Lowest-custom 2

Apply a queue on an interface

Custom-queue-list 1


=================================================================

R1

=================================================================

Queue-list 1 Interface fastethernet2/0 2

Queue-list 1 Protocol IP 3 TCP www

Queue-list 1 Queue 1 Byte-count limit 100

Queue-list 1 Queue 2 Byte-count limit 200

Queue-list 1 Queue 3 Byte-count limit 300

Queue-list 1 Lowest-custom 4


Interface SERIAL0/1

Custom-queue-list 1


viewing queues on an interface

Show int S0/1

View Queue Configuration

Show Queueing Custom

Test queue is in effect

Debug Custom-queue

Show Queueing Interface S0/1



Weighted Fair Queue (WFQ)

By default: When the interface speed is less than 2.048Mbps, the router uses WFQ to dispatch.


Classification: Packets with the same protocol type, source IP, Destination IP, source port, Destination port, TOS value as a stream, packets of the same stream will be placed in a queue.

Insert Discard: When the queue is full, the packet will execute WFQ discard, discarding the worst-time packet

Dispatch: Dispatch the fastest forward packet, packet size with virtual packet size (Virtual package size = actual packet size/(IP priority + 1))

Advantage: The higher the priority, the smaller the packet priority to be forwarded



WFQ Discard mechanism: (packets that discard the worst completion time)

Hqo (holding Queue out Limit): The maximum number of packets that the entire WFQ system can hold, this value is list and for each team.

CDT (Congestive Discard Threshold): The threshold value of the Wfq drop mechanism, which starts discarding packets when the sum of the packets in each queue reaches the CDT.


=================================================================

R1

=================================================================

Interface SERIAL0/1

Fair-queue(Specify CDT to 512, Max Sessions is 64)

Hold-queue(Designation HQO is 1500)


viewing queues on an interface

Show int S0/1



Class-based weighted fair queueing (CBWFQ)


Classification: Allow custom classes, put data into different queues, up to 64 classes can be defined, unmatched data is placed in the system default class Class-default

Insert Discard: The queue length can be set, and after the queue is full, the packet will be discarded by tail

Dispatch: The specified bandwidth is reserved for each queue, and each queue defaults to FIFO scheduling, but can also be combined with WFQ scheduling. How to ensure bandwidth and how each queue packet is dispatched to the hardware queue is unknown.

Pros: Ensure minimum bandwidth for traffic, not limit maximum bandwidth


=================================================================

R1

=================================================================

Access-list 1 Permit 192.168.1.100

Access-list 2 Permit 192.168.1.1

Class-map Match-all 100

Match Access-group 1

Class-map Match-all 1

Match Access-group 2


Policy-map MARK

Class 100

Bandwidth 500

Class 1

Bandwidth 500


Interface SERIAL0/1

Service-policy Output MARK


View commands

Show Class-map

Show Policy-map

Show Policy-map Interface S0/1


Low latency Queue (LLQ)


The LLQ configuration is similar to CBWFQ and the scheduling mechanism is similar to PQ. LLQ are usually used in conjunction with CBWFQ.

=================================================================

R1

=================================================================

Class-map Match-any CLASS-MAP3

Match IP Precedence 5

Class-map Match-all CLASS-MAP2

Match Protocol Telnet

Class-map Match-any Class_map1

Match Protocol HTTP

Match Protocol FTP


Policy-map My-policy

Class Class_map1

Bandwidth 512

Class Class-map2

Bandwidth 128

Queue-limit 128

Class CLASS-MAP3

Priority 128


Interface serial0/0

Bandwidth 1024

Service-policy Output My-policy


In this example, LLQ and CBWFQ are used together.

CLASS-MAP3 with LLQ, guaranteed bandwidth of 128kbps, priority over CLASS-MAP1,CLASS-MAP2 forwarding

CLASS-MAP1,CLASS-MAP2 uses WFQ to ensure that the bandwidth is 512kbps,128kbps respectively.

View commands

Show Class-map

Show Policy-map

Show Policy-map Interface s0/0


RTP Priority queue

RTP Priority queue is a simple technique to solve the quality of voice service, in which the RTP packets carrying the voice are sent to the priority queue so that they are forwarded preferentially.

RTP UDP packet ports that recognize voice, which are typically sent using an even port of 16384~32767.

The RTP priority queue can be used in conjunction with any of the preceding queues including FIFO, PQ, CQ, WFQ, CBWFQ, LLQ, but it has the highest precedence. RTP has a higher priority than LLQ even if RTP is used with LLQ.


Interface serial0/0

IP RTP priority 16384 16383 256

16384 minimum UDP port number, 16383 port increment, bandwidth 256kbps



5. Congestion avoidance

Random early pre-detection (RED)

Set two thresholds for the queue: Minimum gate limit and maximum gate limit, when the average length of the queue is less than the minimum limit, the packet is not discarded;

Red starts randomly discarding packets when the average length of the queue is between the minimum and maximum gate limits, discarding all packets at the end of the queue when the average length is greater than the maximum gate limit.


Weighted random early pre-detection (WRED)

Wred and red are the same principle, but wred can set different minimum gate limits, threshold limits, and drop probabilities based on different IP priorities or DSCP values, thus providing different drop characteristics for packets of different priority levels.

Wred cannot be used in conjunction with PQ, CQ, WFQ queues.


Configuring IP precedence-based wred

Random-detect

Sets the minimum gate limit for the packet, the threshold limit, and the drop probability of the dropped packet based on the IP precedence (the probability should be 1/10 in this case)

Random-detect Precedence 1 10 20 10

Configuring DSCP-based Wred

Random-detect dscp-based

Sets the minimum gate limit for the packet, the threshold limit, and the drop probability of the dropped packet based on the DSCP (the probability should be 1/10 in this case)

Random-detect DSCP af22 10 20 10

Sets the weight factor for the average length of the calculation queue (default is 9)

Random-detect Exponential-weighting-constant 9


View wred Queue Configuration

Show Queueing int s0/0


Stream-based weighted random early pre-detection (fb-wred)

In wred, only TCP flows react to drops and reduce the rate, while non-adaptive streams such as UDP do not react to packet drops, so non-adaptive streams such as UDP can send packets at congested rates much higher than adaptive streams.

Fb-wred to wred In addition to the improvement, he will be punished for the excess of the fair share of the occupied queue resources.


The fb-wred places the arriving packets into different queues based on the stream and IP priority (or DSCP value), and calculates the Fair queue resource share (the number of queue lengths/active streams) for each active stream.

The flow that consumes the extra fair share of queue resources will be punished. The method is to increase the drop probability of the packet by decreasing the wred limit of the queue.

New maximum threshold = minimum threshold value +{(maximum threshold-minimum threshold)/2}


Configure fb-wred (WRED must be configured first)

Random-detect Flow

Set the average depth factor (that is, the magnification factor, the default value is 4)

Random-detect Flow Average-depth-factor 4

To set the number of streams-based wred data streams

Random-detect Flow Count 32


View wred Queue Configuration

Show Queueing int s0/0


Class-based weighted random early pre-detection (cb-wred)

Cb-wred can be combined with CBWFQ and shaping, but not with fb-wred, LLQ and policing.


Class-map Match-any http-ftp

Match Protocol HTTP

Match Protocol FTP


Policy-map My-policy

Class Http-ftp

Bandwidth 512

Random-detect

Random-detect Precedence 0 20 30 10

Interface serial0/0

Bandwidth 1024

Service-policy Output My-policy

This example enables priority-based wred to be combined with CBWFQ.



View commands

Show Class-map

Show Policy-map

Show Policy-map int s0/0



6. Traffic Shaping (Shaping)

The purpose of traffic shaping is to smooth traffic, traffic shaping will be exceeded the specified rate of data buffering, not discarded, the average traffic rate of the link is large, but will cause data delay or delay jitter.


The relevant noun of the token bucket:

CIR: Committed information rate, Unit bps

PRI: Committed information rate, Unit bps

Bc: The size of the normal burst, in bytes

BE: The size of the excess burst, in bytes

Tc: Time interval

Cir=bc/tc


When a token bucket, the size of the bucket is bc+be;

The token is added to the token bucket at the rate of the CIR;

When a packet is forwarded out, if it cannot get enough tokens from the token bucket, the packet is cached and enough tokens are sent. The average rate of packets sent does not exceed CIR, but at some point it can be sent at a rate of more than Cir Bc+be.


GTS General traffic shaping the software queue is then added to the queue for implementation, which uses WFQ. GTS can be used in conjunction with FIFO, PQ, CQ, Wfq.


CLI Configuration method

Interface SERIAL0/1

Traffic-shape Rate 8000 1500 1000 1000


MQC Configuration method

Access-list permit ICMP any any


Class-map Match-all ICMP

Match Access-group 100

Policy-map TEST

Class ICMP

Shape Average 8000 1000 1000


Interface SERIAL0/1

Service-policy Output TEST


View commands

Show Traffic-shape

Show Traffic-shape Statistics




7. Traffic supervision (policing)

Traffic regulation can be applied in the out and in two directions of an interface. Divided into single-barrel single-speed two-color, two-barrel single-speed three-color, two-barrel two-speed three-color.

The purpose of traffic supervision is speed limit, traffic regulation will be discarded or marked beyond the specified rate to facilitate subsequent router processing, the traffic rate of the link has a large fluctuation, the overall average bandwidth is low, but does not cause packet delay increase.


The relevant noun of the token bucket:

CIR: Committed information rate, Unit bps

PRI: Committed information rate, Unit bps

Bc: The size of the normal burst, in bytes

BE: The size of the excess burst, in bytes

Tc: Time interval

Cir=bc/tc


Single barrel single-speed two-color


Single token bucket, bucket size is be, not bc+be;

The token is added to the token bucket at the rate of the CIR;

When the packet is to be forwarded, if it is possible to get enough tokens from the token bucket, it becomes conforn, at which point the number of tokens in the bucket is the number of tokens in the previous token minus the packet size, and if the method gets enough tokens from the token bucket, it becomes exceed, and the number of tokens in the bucket does not change.


CLI Configuration method

Interface SERIAL0/1

Rate-limit Output 8000 conform-action transmit exceed-action drop


MQC Configuration method

Access-list permit ICMP any any


Class-map Match-all ICMP

Match Access-group 100


Policy-map TEST

Class ICMP

Police Cir 8000 BC 1000

Conform-action transmit

Exceed-action Drop


Interface SERIAL0/1

Service-policy input TEST


View commands

Show Class-map

Show Policy-map

Show Policy-map int s0/0


Double Barrel single-speed tri-color


Two token barrels, the size of the TB1 is BC,TB2 size is be;

Tokens are added to the TB1 in the token bucket at a rate of CIR, and when TB1 is full, the token overflows into TB2.

When the packet is to be forwarded out, if you can get enough tokens from the token bucket TB1, it becomes conforn, at which point the number of tokens in TB1 is the number of tokens before the packet minus the size of the packet, TB2 the number of tokens does not change;

When the packet is to be forwarded out, if it is not possible to get enough tokens from the token bucket TB1, but can get enough tokens from the token bucket TB2, it becomes exceed, at this time the number of tokens in TB1 is not changed, and the number of tokens in TB2 is the number of tokens minus the size of the packet;

When the packet is to be forwarded out, if it cannot get enough tokens from the token bucket TB1, and cannot get enough tokens from the token bucket TB2, it becomes violate, at which time the number of tokens for TB1 and TB2 are not changed.


Access-list permit ICMP any any


Class-map Match-all ICMP

Match Access-group 100

Policy-map TEST

Class ICMP

Police Cir 8000 BC 1000

Conform-action transmit

Exceed-action Drop

Violate-action Drop


Interface SERIAL0/1

Service-policy input TEST


View commands

Show Class-map

Show Policy-map

Show Policy-map int s0/0


Two-barrel, two-speed tri-color

Two token barrels, the size of the TB1 is BE,TB2 BC;

Tokens are added to the token bucket in TB1 at the rate of PIR, and are added to the token bucket at a rate of CIR TB2,pir>=cir;

When the packet is to be forwarded out, if you can get enough tokens from the token bucket TB1, you can also get enough tokens from the token bucket TB2, it becomes conforn, at this time the number of tokens in TB1 is the number of tokens minus the size of the packet, and the number of tokens in TB2 is the size of the previous token minus the packet;

When the packet is to be forwarded out, if you can get enough tokens from the token bucket TB1, but cannot get enough tokens from the token bucket TB2, it becomes exceed, at this time the number of tokens in TB1 is the number of tokens before the size of the packet minus the packets, TB2 the number of tokens unchanged;

When the packet is to be forwarded out, if it cannot get enough tokens from the token bucket TB1, and cannot get enough tokens from the token bucket TB2, it becomes violate, at which time the number of tokens for TB1 and TB2 are not changed.


Access-list permit ICMP any any


Class-map Match-all ICMP

Match Access-group 100

Policy-map TEST

Class ICMP

Police Cir 8000 BC the PIR 8000 be 1500

Conform-action transmit

Exceed-action Drop

Violate-action Drop


Interface SERIAL0/1

Service-policy input TEST


View commands

Show Class-map

Show Policy-map

Show Policy-map int s0/0


This article is from the "Open Source Hall" blog, please be sure to keep this source http://kaiyuandiantang.blog.51cto.com/10699754/1917872

1. QoS based on Cisco routers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.