Using Generic Traffic Shaping

Problem

You want to do traffic shaping on an interface.

Solution

Generic Traffic Shaping works on an entire interface to limit the rate that it sends data. This first version restricts all outbound traffic to 500,000 bits per second:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface FastEthernet0/0
Router(config-if)#traffic-shape rate 500000
Router(config-if)#exit
Router(config)#end
Router#

You can also specify traffic shaping for packets that match a particular access-list. This will buffer only the matching traffic, and leave all other traffic to use the default queuing mechanism for the interface:

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#access-list 101 permit tcp any eq www any
Router(config)#access-list 101 permit tcp any any eq www
Router(config)#access-list 102 permit tcp any eq ftp any 
Router(config)#access-list 102 permit tcp any any eq ftp
Router(config)#interface FastEthernet0/0
Router(config-if)#traffic-shape group 101 100000
Router(config-if)#traffic-shape group 102 200000
Router(config-if)#exit
Router(config)#end
Router#

There is also a newer class-based method for configuring traffic shaping on an interface using CBWFQ. We discuss this technique in Recipe 11.16.

Discussion

The first example shows how to configure an interface to restrict the total amount of outbound information. This is extremely useful when there is something ...

Get Cisco IOS Cookbook, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.