Using Priority Queuing

Problem

You want to enable strict priority queues on an interface so that the router always handles high priority packets first.

Solution

To enable priority queuing on an interface, you must first define the priority list, and then you can apply it to the interface:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#access-list 101 permit ip any any precedence 5 tos 12
Router(config)#access-list 102 permit ip any any precedence 4
Router(config)#access-list 103 permit ip any any precedence 3
Router(config)#priority-list 1 protocol ip high list 101
Router(config)#priority-list 1 protocol ip medium list 102
Router(config)#priority-list 1 protocol ip normal list 103
Router(config)#priority-list 1 default low
Router(config)#interface Ethernet0
Router(config-if)#priority-group 1
Router(config-if)#exit
Router(config)#end
Router#

 

Discussion

As we discuss in Appendix B, priority queues strictly ensure that high priority packets are always handled before lower priority packets. We stress that using pure priority queuing like this is usually a bad idea because the higher priority traffic can take all of the available bandwidth and completely starve all other network traffic. You only want to use this style of queuing when you can be absolutely certain that the aggregate bandwidth of all high priority traffic will never consume the available link bandwidth. This could be the case, for example, if the high priority traffic is shaped before reaching this router, or for applications like Voice over IP (VoIP) that use a relatively constant amount of bandwidth, and don't burst above this constant rate.

The priority-list command has a relatively flexible syntax for identifying what types of traffic will use which queues. However, we prefer the access-list method shown in the example. This is because it gives the greatest range of possibilities for identifying traffic types.

In the example, we use access-list 101 to decide which packets to send to the high priority queue:

Router(config)#access-list 101 permit ip any any precedence 5 tos 12

If you write out the bit patterns for an IP Precedence value of 5 and a TOS of 12, you get 101 and 1100. Combining these together and dropping the last bit gives 101110, which is identical to the Expedited Forwarding (EF) DSCP value. This is typically the DSCP value that is used to mark packets for real-time applications.

Cisco introduced a dscp keyword to the access-list command in IOS Version 12.1(5)T. This allows you to accomplish the same thing with a slightly simpler access list. This access list should also process faster because it only makes one comparison instead of two:

Router(config)#access-list 101 permit ip any any dscp ef

The access-lists that define the other queues also select specific IP Precedence values. This is because we want to carefully limit the amount of processing that the router has to do. The less the access-list has to look at, the better.

Note also that the router will process the priority list in the order that it was entered. In general you will want to keep queuing latency for high priority packets as low as possible. This is why we define the higher priority queues first.

In the example, we also specifically included a command to put any unmatched packets into the low priority queue:

Router(config)#priority-list 1 default low

If we had not included this command, the router would have used the normal priority queue for any unmatched packets by default.

You can look at priority queuing information on an interface with the show interface command:

Router#show interface Ethernet0
Ethernet0 is up, line protocol is up 
 Hardware is Lance, address is 0000.0cf0.8460 (bia 0000.0cf0.8460)
 Internet address is 192.168.1.201/24
 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
 reliability 255/255, txload 1/255, rxload 1/255
 Encapsulation ARPA, loopback not set, keepalive set (10 sec)
 ARP type: ARPA, ARP Timeout 04:00:00
 Last input 00:00:00, output 00:00:00, output hang never
 Last clearing of "show interface" counters never
 Input queue: 0/75/0 (size/max/drops); Total output drops: 0
 Queuing strategy: priority-list 1
 Output queue (queue priority: size/max/drops):
 high: 0/20/0, medium: 0/40/0, normal 0/60/0, low 0/80/0
 5 minute input rate 1000 bits/sec, 2 packets/sec
 5 minute output rate 2000 bits/sec, 2 packets/sec
 7390 packets input, 655552 bytes, 0 no buffer
 Received 6687 broadcasts, 0 runts, 0 giants, 0 throttles
 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
 0 input packets with dribble condition detected
 81097 packets output, 6240100 bytes, 0 underruns
 2 output errors, 0 collisions, 7 interface resets
 0 babbles, 0 late collision, 0 deferred
 2 lost carrier, 0 no carrier
 0 output buffer failures, 0 output buffers swapped out
Router#

In this case, you can see that the high-priority queue has a maximum depth of 20 packets. The medium queue can hold 40 packets, normal holds 60, and the low-priority queue can hold 80 packets. This increasing queue depth pattern is necessary to help deal with queue starvation problems. You can modify these default values as follows:

Router(config)#priority-list 1 queue-limit 10 15 25 35

This command sets the depths for all of the queues in increasing order. This particular example would set the high-priority queue to hold a maximum of 10 packets, 15 for the medium queue, 25 for the normal queue, and 35 for the low-priority queue.

Note that the router will automatically use the high-priority queue for critical network control information, such as routing updates and keepalives. If these packets are not sent in a timely fashion, it can disrupt how the network functions. If the router were to put this critical information into a lower priority queue, there would be a danger that higher priority application traffic could starve the lower priority queues, and disrupt routing or possibly even bring down parts of the network. CBWFQ and Cisco's new Low Latency Queuing (LLQ) algorithm offer all of the advantages of Priority Queuing discussed here, and fewer of the disadvantages. This feature is discussed in Recipe 11.16. We recommend using LLQ instead of Priority Queuing, if your router supports it. Cisco introduced LLQ in IOS level 12.0(6)T.

See Also

Recipe 11.16

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index



Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net