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:


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:


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!

renjithbs Avatar

Posted by

Leave a comment