Using Weighted Fair Queuing


You want your routers to use the TOS/DSCP fields when forwarding packets.


The simplest way to make your routers use DSCP or TOS information is to just make sure that Weighted Fair Queuing is enabled:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface Serial0/0

WFQ is enabled by default on all interfaces of E1 speeds (roughly 2 Mbps) or less. You can enable WFQ on higher speed interfaces as well, but we don't recommend it.

To configure more specific behavior, you can tell WFQ how to allocate its queues:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface Serial0/0
Router(config-if)#fair-queue 64 512 10



Before we discuss these examples in any detail, we should mention that WFQ works well even if you don't use any TOS/DSCP marking. In this case, it simply gives the same default weighting to every flow, which is the same as conventional Fair Queuing (without the weights). As we discuss in Appendix B, Fair Queuing is much more effective than FIFO queuing. However, with TOS/DSCP marking, WFQ really shows its value, giving higher priority flows more of the bandwidth, and preventing high volume flows from starving low volume flows, regardless of their TOS markings.

The first example just enables WFQ on the interface. In fact, this is the default for all interfaces that operate slower than 2.048 Mbps (E1 speed), except for interfaces that use LAPB or SDLC. WFQ does not work with LAPB or SDLC.

The second example is a little bit more interesting, though, because it changes the default queues. The fair-queue command has three optional parameters. In the example, we specified:

Router(config-if)#fair-queue 64 512 10

The first number specifies the congestive discard threshold. This just means that if there are more than 64 packets in any given queue, the router will start to discard any new packets. The default threshold is 64.

The second number is the number of dynamic queues. The values must be a multiple of 16 to a maximum of 4,096 (i.e., one of the following values: 16, 32, 64, 128, 256, 512, 1,024, 2,048, and 4,096). The default value is 256. If this interface must support a large number of flows, then it is a good idea to choose a larger value.

The last number, 10 in this case, is the number of queues that the router will set aside for RSVP reservation requests. Please see Recipes 11.10, 11.11, and 11.12 for more information about RSVP.

In most cases, the default parameters are good enough. However, there are two times in particular when it is useful to modify them. First, if the interface must support an extremely large number of flows, you will get better performance by using a larger number of queues. However, you need to be careful doing this on faster interfaces because the router may start to have trouble processing the additional queues. In that case, you could actually get a performance improvement by decreasing the number of queues. In this case, each queue could wind up simultaneously handling a few distinct flows.

You will also need to change the default queue parameters if you are using RSVP to reserve queues. By default, this parameter is zero. So if you are using RSVP with WFQ, you must allocate some reserved queuing space.

See Also

Recipe 11.10; Recipe 11.11; Recipe 11.12

Router Configuration and File Management

Router Management

User Access and Privilege Levels


IP Routing





Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time


Router Interfaces and Media

Simple Network Management Protocol





First Hop Redundancy Protocols

IP Multicast

IP Mobility




Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications


Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505 © 2008-2020.
If you may any questions please contact us: