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
| Feature | Shaping | Policing |
|---|---|---|
| Purpose | Slows down traffic | Drops or marks excess traffic |
| Effect on Packets | Buffers packets in a queue | Discards or reclassifies packets |
| Use Case | WAN links, avoiding congestion | Enforcing strict bandwidth limits |
| Typical Deployment | Outbound (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
| Scenario | Configuration |
|---|---|
| Shape all traffic to 5 Mbps | traffic-shape rate 5000000 |
| Shape VoIP to 1 Mbps | shape average 1000000 |
| Hierarchical shaping for multiple classes | Parent + Child Policy Maps |
| Verify shaping | show policy-map interface |
🚀 Traffic shaping ensures a smooth and stable network experience by preventing congestion!
Leave a comment