The three tools mentioned in the chapter title are used for traffic shaping. Traffic shaping involves delaying packets when exiting a router to ensure the traffic rate doesn't exceed a configured bit rate. We'll be discussing both concepts and the Cisco tools for shaping- Frame Relay Traffic Shaping and Class-Based Shaping.
Traffic policers moderate packet rates for trafffic entering or exiting a router. Once the defined rate is exceeded, the policer either remarks packets or discards enough to reach the proscribed bit rate. Traffic shaping in Cisco routers uses a shaping queue, which is used to delay packets and help them match the configured rate.
Traffic shaping is used to solve 2 problems in a multi-access network: first it discards traffic to ensure conformance, preventing customers from sending more than the agreed upon rate. Secondly, egress blocking is partially resolved. Egress blocking occurs when a frame relay or ATM switch has to queue data on the VC. Shaping moves this queuing to the router and allows for manipulation with queuing tools.
Details of Cisco Shaping
Theory
The Cisco shaper process uses a base time interval, known as Tc. It uses that time interval to calculate the number of bits that can be sent, per second, to match the configured shaping rate. Bc, or comitted burst, is the amount of data that can be sent per Tc interval. Comitted information rate, or CIR, is the defined rate of a VC. Excess burst, or BE, is the amount of data beyond Bc that can be sent after a period of inactivity.
The excess burst concept is used to deal with bursty traffic. After a period in which less data than the CIR has been sent, more than Bc bits can be sent over the course of one or more Tc intervals. If configured, the shaper allows Be extra bits to be sent.
Details
The formula used to calculate Tc is easy:
Tc = Bc / shaping rate
The values available determine how the remaining portion is calculated. For example if both Tc and shaping rate are configured on the router, Bc will be calculated as shaping rate * Tc using a derivative of the formula.
However, both frame relay traffic shaping and class based traffic shaping may use default values in some cases.
A token bucket model is used to handle shaping. Let's review a couple of situations to better understand the token bucket. First, consider a situation where Be is not configured. A bucket the size of Bc is filled with tokens at the start of each Tc, giving the ability to send Bc amount of data.
The shaper will perform two functions related to the bucket: fill it with tokens, and spend them to forward packets. If the bucket is refilled and tokens still remain from the prior fill-up, any amount greater than Bc is excess and will not be used. To send a packet there must be enough tokens in the bucket; a token is equal to a bit. Hence, 1000 tokens are needed to send a 1000 bit packet. If not enough bits are available, the shaper must wait until the next interval.
In a second model, the Be model is implemented by making the single token bucket bigger. This allows for more tokens than Bc to be available at the beginning of an interval once the bucket is refilled.
Frame Relay and Traffic Shaping
When shaping traffic over a frame relay network, you can configure it to adjust the shaping rate over time based on presence or absence of traffic congestion. Effectively, you can set a floor for traffic shaping. As congestion increases, the shaper lowers the shaping rate. The minimum by default is 50%, but it can also be configured. This floor is known as the minimum information rate (MIR) or mincir.
Cisco routers detect congestion and lower the shaping rate in response to one of two inputs:
Generic Traffic Shaping (GTS)
GTS is a form of traffic shaping available on most routers, but not usable with flow switching. GTS is configured at the interface or subinterface level. The basic GTS configuration shapes all traffic leaving the interface but you can implement a more advanced setup using an ACL to identify a subset of traffic which is to be shaped. The ACL should permit traffic to be shaped and implicitly deny all other traffic.
The command to enable GTS is traffic-shape rate shaped-rate [Bc] [Be] [buffer-limit]
The shaped rate is specified in bps, and the Bc and Be figures are in bits. Buffer-limit sets the maximum size of the queue buffer and is set in bps. Only the shaped-rate is required; Bc and Be values will default to 1/4 of the shaped-rate if not explicitly specified.
GTS can also be configured on frame relay interfaces. First you'll need to configure the traffic-shape rate command, as above, and add the following separate command: traffic-shape adaptive bit-rate. The bit-rate in this command is given in bps and it specifies the minimum bandwidth the router will use if it receives BECNs.
Traffic policers moderate packet rates for trafffic entering or exiting a router. Once the defined rate is exceeded, the policer either remarks packets or discards enough to reach the proscribed bit rate. Traffic shaping in Cisco routers uses a shaping queue, which is used to delay packets and help them match the configured rate.
Traffic shaping is used to solve 2 problems in a multi-access network: first it discards traffic to ensure conformance, preventing customers from sending more than the agreed upon rate. Secondly, egress blocking is partially resolved. Egress blocking occurs when a frame relay or ATM switch has to queue data on the VC. Shaping moves this queuing to the router and allows for manipulation with queuing tools.
Details of Cisco Shaping
Theory
The Cisco shaper process uses a base time interval, known as Tc. It uses that time interval to calculate the number of bits that can be sent, per second, to match the configured shaping rate. Bc, or comitted burst, is the amount of data that can be sent per Tc interval. Comitted information rate, or CIR, is the defined rate of a VC. Excess burst, or BE, is the amount of data beyond Bc that can be sent after a period of inactivity.
The excess burst concept is used to deal with bursty traffic. After a period in which less data than the CIR has been sent, more than Bc bits can be sent over the course of one or more Tc intervals. If configured, the shaper allows Be extra bits to be sent.
Details
The formula used to calculate Tc is easy:
Tc = Bc / shaping rate
The values available determine how the remaining portion is calculated. For example if both Tc and shaping rate are configured on the router, Bc will be calculated as shaping rate * Tc using a derivative of the formula.
However, both frame relay traffic shaping and class based traffic shaping may use default values in some cases.
A token bucket model is used to handle shaping. Let's review a couple of situations to better understand the token bucket. First, consider a situation where Be is not configured. A bucket the size of Bc is filled with tokens at the start of each Tc, giving the ability to send Bc amount of data.
The shaper will perform two functions related to the bucket: fill it with tokens, and spend them to forward packets. If the bucket is refilled and tokens still remain from the prior fill-up, any amount greater than Bc is excess and will not be used. To send a packet there must be enough tokens in the bucket; a token is equal to a bit. Hence, 1000 tokens are needed to send a 1000 bit packet. If not enough bits are available, the shaper must wait until the next interval.
In a second model, the Be model is implemented by making the single token bucket bigger. This allows for more tokens than Bc to be available at the beginning of an interval once the bucket is refilled.
Frame Relay and Traffic Shaping
When shaping traffic over a frame relay network, you can configure it to adjust the shaping rate over time based on presence or absence of traffic congestion. Effectively, you can set a floor for traffic shaping. As congestion increases, the shaper lowers the shaping rate. The minimum by default is 50%, but it can also be configured. This floor is known as the minimum information rate (MIR) or mincir.
Cisco routers detect congestion and lower the shaping rate in response to one of two inputs:
- receiving a frame with the BECN bit set
- receiving a Cisco-proprietary Foresight congestion message
Generic Traffic Shaping (GTS)
GTS is a form of traffic shaping available on most routers, but not usable with flow switching. GTS is configured at the interface or subinterface level. The basic GTS configuration shapes all traffic leaving the interface but you can implement a more advanced setup using an ACL to identify a subset of traffic which is to be shaped. The ACL should permit traffic to be shaped and implicitly deny all other traffic.
The command to enable GTS is traffic-shape rate shaped-rate [Bc] [Be] [buffer-limit]
The shaped rate is specified in bps, and the Bc and Be figures are in bits. Buffer-limit sets the maximum size of the queue buffer and is set in bps. Only the shaped-rate is required; Bc and Be values will default to 1/4 of the shaped-rate if not explicitly specified.
GTS can also be configured on frame relay interfaces. First you'll need to configure the traffic-shape rate command, as above, and add the following separate command: traffic-shape adaptive bit-rate. The bit-rate in this command is given in bps and it specifies the minimum bandwidth the router will use if it receives BECNs.
