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 downstream that will not cope well with hard bursts of traffic.
A common example is the method of delivering ATM WAN services through an Ethernet interface, frequently called LAN Extension. In this type of network, the Ethernet port on your router connects to the carrier's switch, which bridges one or more remote Ethernet segments by using an ATM network. The problem with this is that the Ethernet interface is able to send data much faster than the ATM network is configured to accept it. So you run the risk of dropping large numbers of packets within the ATM network. Since the carrier networks usually don't support customer Layer 3 QoS features, the entire ATM network acts just like a big FIFO queue with a tail drop problem. As we discuss in Appendix B, this is extremely inefficient.
So this is why it can be extremely useful to restrict the total amount of traffic leaving an interface. It can also be useful to restrict only certain applications, as we demonstrated in the second example. However, we discuss more efficient Class-based methods for controlling the total amount of traffic of a particular type in Recipe 11.7. So this older group traffic-shaping method should only be used on routers that do not support CBWFQ.
See Also
Recipe 11.7; Recipe 11.15; Recipe 11.16