Traffic Shaping in QoS

1. Introduction

Traffic shaping is a QoS mechanism that controls the rate of outbound traffic to prevent network congestion and packet loss. It smooths traffic bursts by buffering and delaying packets to maintain a steady transmission rate.

๐Ÿ“Œ Key Benefits of Traffic Shaping: โœ… Prevents network congestion
โœ… Ensures consistent bandwidth allocation
โœ… Helps with Service Level Agreements (SLAs)
โœ… Reduces packet drops in bursty traffic


2. How Does Traffic Shaping Work?

Traffic shaping buffers excess packets in a queue instead of dropping them, then sends them at a regulated rate.

Shaping vs. Policing

FeatureShapingPolicing
PurposeSlows down trafficDrops or marks excess traffic
Effect on PacketsBuffers packets in a queueDiscards or reclassifies packets
Use CaseWAN links, avoiding congestionEnforcing strict bandwidth limits
Typical DeploymentOutbound (egress)Inbound (ingress) & outbound

3. Configuring Traffic Shaping on Cisco Routers

Cisco uses Class-Based Traffic Shaping (CBTS) to configure shaping per class of traffic.

A. Shaping All Traffic on an Interface

To shape all traffic on an interface to 5 Mbps:

interface Serial0/0/0
traffic-shape rate 5000000

B. Class-Based Traffic Shaping

1๏ธโƒฃ Define a Class to Match Traffic:

class-map MATCH-VOICE
match ip dscp ef

2๏ธโƒฃ Create a Policy Map to Shape Traffic:

policy-map SHAPE-POLICY
class MATCH-VOICE
shape average 1000000

3๏ธโƒฃ Apply to an Interface:

interface GigabitEthernet1/0/1
service-policy output SHAPE-POLICY

๐Ÿ”น Explanation:

  • Traffic matching DSCP EF (VoIP) is shaped to 1 Mbps.
  • Other traffic is not affected unless added to the policy.

C. Configuring Hierarchical Shaping

For multiple traffic types, use Hierarchical QoS:

policy-map CHILD-POLICY
class MATCH-VOICE
priority 500
class MATCH-VIDEO
shape average 2000000

policy-map PARENT-POLICY
class class-default
shape average 5000000
service-policy CHILD-POLICY

๐Ÿ“Œ This means:

  • The parent policy shapes all traffic to 5 Mbps.
  • The child policy shapes VoIP to 500 Kbps and Video to 2 Mbps.

4. Verifying Traffic Shaping

โœ… To check if shaping is working:

show policy-map interface GigabitEthernet1/0/1

โœ… To monitor traffic rates:

show interfaces GigabitEthernet1/0/1 | include rate

5. Summary

ScenarioConfiguration
Shape all traffic to 5 Mbpstraffic-shape rate 5000000
Shape VoIP to 1 Mbpsshape average 1000000
Hierarchical shaping for multiple classesParent + Child Policy Maps
Verify shapingshow policy-map interface

๐Ÿš€ Traffic shaping ensures a smooth and stable network experience by preventing congestion!

Comments

Leave a comment