Back to Dashboard
Module 44
Traffic Policing and Shaping
โ Previous Module
Next Module โ
# ๐ CCNA 200-301 - Video 44: Traffic Policing and Shaping ## Deep Study Notes --- ## ๐ Learning Objectives By the end of this video, you should understand: - What traffic policing and shaping are - Policing vs. Shaping differences - Traffic policing mechanisms (single-rate, two-rate) - Traffic shaping mechanisms - Configuration examples - When to use policing vs. shaping --- ## ๐ง Core Concepts ### 1. What are Policing and Shaping? **Definition:** Traffic policing and shaping are QoS mechanisms that control the rate of traffic to enforce a configured rate limit (CIR - Committed Information Rate). **Analogy:** Think of policing and shaping like water flow control: - **Policing:** A gate that either lets water through or stops it completely. If too much water comes, it spills over (dropped). - **Shaping:** A reservoir that stores excess water and releases it slowly over time, smoothing out the flow. ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ POLICING vs. SHAPING โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ POLICING: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ Incoming Traffic: โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โผ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ Police (Drop excess) โ โ โ โ โ โ โ โ โ โ โ โ CIR = 1 Mbps โ โ โ โ โ โ Excess traffic: DROPPED โ โ โ โ โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โผ โ โ โ โ Outgoing Traffic: โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ (Rate limited, no buffering) โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ SHAPING: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ Incoming Traffic: โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โผ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ Shaper (Buffer excess) โ โ โ โ โ โ โ โ โ โ โ โ CIR = 1 Mbps โ โ โ โ โ โ Excess traffic: BUFFERED โ โ โ โ โ โ Buffer: [Excess][Excess][Excess] โ โ โ โ โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โผ โ โ โ โ Outgoing Traffic: โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ (Rate limited, smoothed) โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ### 2. Policing vs. Shaping Comparison | Feature | Policing | Shaping | |---------|----------|---------| | **Action** | Drops or remarks excess traffic | Buffers excess traffic | | **Direction** | Inbound or outbound | Outbound only | | **Buffer** | No buffer (or limited) | Uses buffer (queue) | | **Delay** | No added delay | Adds delay (buffering) | | **Effect** | Hard rate limit | Smooths traffic bursts | | **Best For** | Enforcing strict limits, ingress | Egress, meeting CIR, provider links | | **Resource Usage** | Lower CPU/memory | Higher CPU/memory | | **Retransmission** | Relies on TCP retransmission | May cause TCP timeouts if buffer too large | ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ POLICING vs. SHAPING GRAPHICAL โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ INGRESS TRAFFIC (Bursty): โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ Rate โ โ โ โ โ โ โ โ โ 1Mโ โโโโ โ โ โ โ โ โโโโ โ โ โ โ 800Kโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โ โ โ โ 600Kโ โโโโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โโโโ โ โ โ โ 400Kโ โโโโ โโโโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โโโโ โโโโ โ โ โ โ 200Kโ โโโโ โโโโ โโโโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โโโโ โโโโ โโโโ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ Time โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ AFTER POLICING (Drop Excess): โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ Rate โ โ โ โ โ โ โ โ โ 1Mโ โโโโ โ โ โ โ โ โโโโ โ โ โ โ 800Kโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โ โ โ โ 600Kโ โโโโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โโโโ โ โ โ โ 400Kโ โโโโ โโโโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โโโโ โโโโ โ โ โ โ 200Kโ โโโโ โโโโ โโโโ โโโโ X โ โ โ โ โ โโโโ โโโโ โโโโ โโโโ X โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ Time โ โ โ โ X = Dropped packet โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ AFTER SHAPING (Buffer Excess): โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ Rate โ โ โ โ โ โ โ โ โ 1Mโ โ โ โ โ โ โ โ โ โ 800Kโ โ โ โ โ โ โ โ โ โ 600Kโ โ โ โ โ โ โ โ โ โ 400Kโ โ โ โ โ โ โ โ โ โ 200Kโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โ โ โ โ โ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โโโโ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ Time โ โ โ โ โ โ โ โ Traffic is smoothed, bursts are buffered and transmitted later โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ### 3. Traffic Polishing (Policing) **Policing Terminology:** | Term | Description | |------|-------------| | **CIR (Committed Information Rate)** | Guaranteed rate (bits per second) | | **CBS (Committed Burst Size)** | Amount of traffic that can burst within CIR | | **EIR (Excess Information Rate)** | Rate above CIR that can be sent (if available) | | **EBS (Excess Burst Size)** | Amount of traffic that can burst above CIR | | **Conform Action** | Action for traffic within CIR (transmit) | | **Exceed Action** | Action for traffic above CIR but within EIR (drop/remark) | | **Violate Action** | Action for traffic above EIR (drop) | ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ POLICING BUCKET MODEL โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ Token Bucket Model: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ Tokens added at rate CIR โ โ โ โ โ โ โ โ โ โผ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ Token Bucket โ โ โ โ โ โ (CBS) โ โ โ โ โ โ โ โ โ โ โ โ Tokens: [T][T][T][T][T] โ โ โ โ โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โ Packet arrives, consumes tokens โ โ โ โ โผ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ If tokens available: Conform (transmit) โ โ โ โ โ โ If no tokens: Exceed (drop or remark) โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ### 4. Policing Configuration **Single-Rate Policing (CIR only):** ```cisco ! Police traffic to 1 Mbps, burst 8000 bytes policy-map POLICE-1MB class class-default police 1000000 8000 conform-action transmit exceed-action drop interface GigabitEthernet0/0 service-policy input POLICE-1MB ``` **Two-Rate Policing (CIR + PIR):** ```cisco ! Two-rate policing: CIR 1 Mbps, PIR 2 Mbps policy-map POLICE-2RATE class class-default police cir 1000000 pir 2000000 conform-action transmit exceed-action set-dscp-transmit af11 violate-action drop interface GigabitEthernet0/0 service-policy input POLICE-2RATE ``` **Policing with Remarking:** ```cisco ! Police and remark excess traffic policy-map POLICE-REMARK class class-default police 1000000 8000 conform-action transmit exceed-action set-dscp-transmit af11 violate-action drop interface GigabitEthernet0/0 service-policy input POLICE-REMARK ``` --- ### 5. Traffic Shaping Configuration **Basic Shaping:** ```cisco ! Shape traffic to 10 Mbps policy-map SHAPE-10MB class class-default shape average 10000000 interface Serial0/0/0 service-policy output SHAPE-10MB ``` **Shaping with Hierarchical Policy (Parent-Child):** ```cisco ! Parent policy for shaping, child for queuing policy-map SHAPE-PARENT class class-default shape average 10000000 service-policy QUEUE-CHILD policy-map QUEUE-CHILD class VOICE priority percent 30 class VIDEO bandwidth percent 25 class DATA bandwidth percent 20 class class-default fair-queue interface Serial0/0/0 service-policy output SHAPE-PARENT ``` **Shaping with Adaptive Shaping (Frame Relay):** ```cisco ! Adaptive shaping based on BECN (Frame Relay) policy-map SHAPE-ADAPTIVE class class-default shape average 1000000 shape adaptive 500000 ! Drop to 500k when congestion detected interface Serial0/0/0 encapsulation frame-relay service-policy output SHAPE-ADAPTIVE ``` --- ### 6. Policing vs. Shaping Use Cases ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ WHEN TO USE POLICING vs. SHAPING โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ USE POLICING WHEN: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โข Enforcing strict rate limits (ISP ingress) โ โ โ โ โข Preventing a customer from exceeding their CIR โ โ โ โ โข Protecting network from DoS attacks โ โ โ โ โข Ingress traffic (cannot buffer what hasn't arrived) โ โ โ โ โข Marking down traffic (remark) โ โ โ โ โข Simple, low-overhead rate limiting โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ USE SHAPING WHEN: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โข Matching service provider CIR (avoid packet drops) โ โ โ โ โข Smoothing bursty traffic (prevent tail drops) โ โ โ โ โข Outbound traffic on WAN links โ โ โ โ โข Frame Relay/ATM networks (BECN adaptation) โ โ โ โ โข When buffering is acceptable (delay-tolerant traffic) โ โ โ โ โข Meeting SLA commitments โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ### 7. Policing and Shaping Verification | Command | Purpose | |---------|---------| | `show policy-map interface [int]` | Display policing/shaping statistics | | `show policy-map` | Display policy map configuration | | `show interfaces [int]` | Display interface drops | | `show queueing interface [int]` | Display shaping queue statistics | **Example Outputs:** ```cisco Router# show policy-map interface serial 0/0/0 Serial0/0/0 Service-policy output: SHAPE-10MB Class-map: class-default (match-any) 12345 packets, 12345678 bytes 5 minute offered rate 5000000 bps, drop rate 0 bps Match: any Traffic Shaping Target/Average Peak Rate Excess Rate Limit Bits/Int 10000000 31250 10000000 10000000 Adapt Queue Packets Bytes Packets Bytes Shaping Active Depth Delayed Delayed Active - 0 12345 12345678 0 0 no Router# show policy-map interface gigabitEthernet 0/0 GigabitEthernet0/0 Service-policy input: POLICE-1MB Class-map: class-default (match-any) 56789 packets, 56789012 bytes 5 minute offered rate 2000000 bps, drop rate 500000 bps Match: any police: cir 1000000 bps, bc 8000 bytes conformed 23456 packets, 23456789 bytes; actions: transmit exceeded 12345 packets, 12345678 bytes; actions: drop violated 0 packets, 0 bytes; actions: drop conformed 1000000 bps, exceed 500000 bps, violate 0 bps ``` --- ### 8. Policing and Shaping Burst Size Calculation **Burst Size Formula:** ``` Bc (Committed Burst) = CIR ร Tc Where: - Bc = Committed Burst (bytes) - CIR = Committed Information Rate (bps) - Tc = Time interval (seconds) Example: CIR = 1,000,000 bps (1 Mbps) Tc = 0.008 seconds (8 ms) Bc = 1,000,000 ร 0.008 = 8,000 bytes ``` ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ BURST SIZE CALCULATION โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ Recommended Burst Sizes: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ CIR (Mbps) โ Bc (Bytes) โ Tc (ms) โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ 1.5 (T1) โ 12,000 โ 64 โ โ โ โ 2 โ 16,000 โ 64 โ โ โ โ 5 โ 40,000 โ 64 โ โ โ โ 10 โ 80,000 โ 64 โ โ โ โ 45 (DS3) โ 360,000 โ 64 โ โ โ โ 100 โ 800,000 โ 64 โ โ โ โ โ โ โ โ Formula: Bc = (CIR ร Tc) / 8 โ โ โ โ Where Tc = 64 ms = 0.064 seconds โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ### 9. Advanced Policing: Percentage-Based ```cisco ! Percentage-based policing (based on interface bandwidth) policy-map POLICE-PERCENT class class-default police percent 50 conform-action transmit exceed-action drop interface GigabitEthernet0/0 bandwidth 10000000 ! 10 Mbps service-policy input POLICE-PERCENT ! This will police to 50% of 10 Mbps = 5 Mbps ``` --- ### 10. Hierarchical QoS (HQoS) ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ HIERARCHICAL QoS (HQoS) โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ Parent Policy (Shaping): โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ policy-map SHAPE-PARENT โ โ โ โ class class-default โ โ โ โ shape average 10000000 โ โ โ โ service-policy QUEUE-CHILD โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โผ โ โ Child Policy (Queuing): โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ โ policy-map QUEUE-CHILD โ โ โ โ class VOICE โ โ โ โ priority percent 30 โ โ โ โ class VIDEO โ โ โ โ bandwidth percent 25 โ โ โ โ class DATA โ โ โ โ bandwidth percent 20 โ โ โ โ class class-default โ โ โ โ fair-queue โ โ โ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ Benefits: โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โข Shape total traffic to match CIR โ โ โ โ โข Within shaped traffic, prioritize classes โ โ โ โ โข Efficient bandwidth utilization โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` --- ## ๐ง Complete Configuration Examples ### Lab 1: Simple Policing (Drop Excess) ```cisco ! Police inbound traffic to 10 Mbps, drop excess policy-map POLICE-INGRESS class class-default police 10000000 80000 conform-action transmit exceed-action drop interface GigabitEthernet0/0 service-policy input POLICE-INGRESS ``` --- ### Lab 2: Policing with Remarking (Two-Rate) ```cisco ! Two-rate policing: CIR 5 Mbps, PIR 10 Mbps ! Conform: transmit ! Exceed: remark to AF11 ! Violate: drop policy-map POLICE-2RATE-REMARK class class-default police cir 5000000 pir 10000000 conform-action transmit exceed-action set-dscp-transmit af11 violate-action drop interface GigabitEthernet0/0 service-policy input POLICE-2RATE-REMARK ``` --- ### Lab 3: Basic Traffic Shaping ```cisco ! Shape outbound traffic to 10 Mbps policy-map SHAPE-OUTBOUND class class-default shape average 10000000 interface Serial0/0/0 service-policy output SHAPE-OUTBOUND ``` --- ### Lab 4: Hierarchical QoS (Shaping + Queuing) ```cisco ! Class maps class-map VOICE match dscp ef class-map VIDEO match dscp af41 class-map DATA match dscp af31 ! Child policy (queuing) policy-map QUEUE-POLICY class VOICE priority percent 30 class VIDEO bandwidth percent 25 class DATA bandwidth percent 20 class class-default fair-queue ! Parent policy (shaping) policy-map SHAPE-POLICY class class-default shape average 10000000 service-policy QUEUE-POLICY interface Serial0/0/0 service-policy output SHAPE-POLICY ``` --- ### Lab 5: Frame Relay Traffic Shaping ```cisco ! Frame Relay traffic shaping with adaptive shaping policy-map FR-SHAPE class class-default shape average 512000 shape adaptive 256000 ! Reduce to 256k when BECN received shape fecn-adapt interface Serial0/0/0 encapsulation frame-relay frame-relay traffic-shaping service-policy output FR-SHAPE ! Map to specific DLCI map-class frame-relay FR-CLASS frame-relay cir 512000 frame-relay bc 8000 frame-relay be 8000 frame-relay adaptive-shaping becn interface Serial0/0/0.1 point-to-point frame-relay interface-dlci 100 class FR-CLASS ``` --- ### Lab 6: Percentage-Based Policing ```cisco ! Police to 50% of interface bandwidth interface GigabitEthernet0/0 bandwidth 10000000 ! 10 Mbps policy-map POLICE-PERCENT class class-default police percent 50 conform-action transmit exceed-action drop interface GigabitEthernet0/0 service-policy input POLICE-PERCENT ``` --- ## โ Exam Tips (For CCNA 200-301) | Topic | What Cisco Tests | |-------|------------------| | **Policing** | Drops excess traffic, inbound/outbound, no buffer | | **Shaping** | Buffers excess traffic, outbound only, adds delay | | **CIR** | Committed Information Rate (guaranteed rate) | | **Bc** | Committed Burst (amount of traffic allowed in time interval) | | **Conform Action** | Traffic within CIR (transmit) | | **Exceed Action** | Traffic above CIR (drop/remark) | | **Hierarchical QoS** | Shaping (parent) + Queuing (child) | ### Common Exam Scenarios: **Scenario 1:** "A customer has a 10 Mbps circuit but only purchased 5 Mbps. The ISP wants to drop all traffic above 5 Mbps. Which QoS tool should be used?" - **Answer:** Policing (ingress on ISP router) **Scenario 2:** "A branch office has a 10 Mbps WAN link but needs to shape traffic to 5 Mbps to match the service provider's CIR. Which QoS tool should be used?" - **Answer:** Shaping (outbound on customer router) **Scenario 3:** "What is the difference between policing and shaping in terms of buffering?" - **Answer:** Policing does not buffer (drops excess); shaping buffers excess traffic ### Mnemonics: **Policing vs. Shaping:** **"P for Police, S for Store"** - **P**olicing: **P**unish (drop) excess traffic - **S**haping: **S**tore (buffer) excess traffic **Policing Actions:** **"C.E.V." - Conform, Exceed, Violate** - **C**onform: Within CIR (transmit) - **E**xceed: Above CIR but within PIR (drop/remark) - **V**iolate: Above PIR (drop) --- ## ๐ Summary (1-Minute Revision) ``` TRAFFIC POLICING AND SHAPING: POLICING: โโโ Action: Drops or remarks excess traffic โโโ Direction: Inbound or outbound โโโ Buffer: None (or minimal) โโโ Delay: No added delay โโโ Use: Enforcing strict limits, ingress โโโ Command: police [cir] [bc] conform-action exceed-action SHAPING: โโโ Action: Buffers excess traffic โโโ Direction: Outbound only โโโ Buffer: Uses queue โโโ Delay: Adds delay โโโ Use: Matching CIR, smoothing bursts โโโ Command: shape average [cir] KEY TERMS: โโโ CIR: Committed Information Rate (guaranteed) โโโ PIR: Peak Information Rate (maximum allowed) โโโ Bc: Committed Burst (tokens per interval) โโโ Be: Excess Burst (additional tokens) โโโ Conform: Within CIR (transmit) โโโ Exceed: Above CIR (drop/remark) โโโ Violate: Above PIR (drop) CONFIGURATION: โโโ police [cir] [bc] conform-action [action] exceed-action [action] โโโ shape average [cir] [bc] โโโ shape adaptive [cir] (Frame Relay) โโโ hierarchical: shape average + service-policy VERIFICATION: โโโ show policy-map interface โโโ show policy-map โโโ show queueing interface ``` --- ## ๐งช Practice Questions **1. What is the primary difference between policing and shaping?** - A) Policing buffers, shaping drops - B) Policing drops, shaping buffers - C) Both buffer traffic - D) Both drop traffic <details> <summary>Answer</summary> <b>B) Policing drops, shaping buffers</b> - Policing drops excess traffic, shaping buffers it. </details> **2. Which direction can shaping be applied?** - A) Inbound only - B) Outbound only - C) Both inbound and outbound - D) Neither <details> <summary>Answer</summary> <b>B) Outbound only</b> - Shaping can only be applied to outbound traffic. </details> **3. What does CIR stand for?** - A) Committed Information Rate - B) Committed Internet Rate - C) Constant Information Rate - D) Configurable Information Rate <details> <summary>Answer</summary> <b>A) Committed Information Rate</b> - The guaranteed rate of traffic. </details> **4. Which QoS tool adds delay to traffic?** - A) Policing - B) Shaping - C) Marking - D) Classification <details> <summary>Answer</summary> <b>B) Shaping</b> - Shaping buffers traffic, adding delay. </details> **5. Which command configures traffic shaping?** - A) `police` - B) `shape average` - C) `bandwidth` - D) `priority` <details> <summary>Answer</summary> <b>B) `shape average`</b> - Configures traffic shaping. </details> **6. What is the typical action for conforming traffic?** - A) Drop - B) Transmit - C) Remark - D) Queue <details> <summary>Answer</summary> <b>B) Transmit</b> - Conforming traffic is within the CIR and is transmitted. </details> **7. Which QoS tool is typically used on ingress to prevent DoS attacks?** - A) Shaping - B) Policing - C) Queuing - D) WRED <details> <summary>Answer</summary> <b>B) Policing</b> - Policing can be applied inbound to drop excess traffic. </details> **8. What is the purpose of hierarchical QoS?** - A) Combine shaping and queuing - B) Combine policing and shaping - C) Combine marking and queuing - D) Combine classification and marking <details> <summary>Answer</summary> <b>A) Combine shaping and queuing</b> - Parent policy shapes, child policy queues. </details> **9. Which command displays policing statistics on an interface?** - A) `show policy-map interface` - B) `show shaping` - C) `show policing` - D) `show queue` <details> <summary>Answer</summary> <b>A) `show policy-map interface`</b> - Displays policing/shaping statistics. </details> **10. What is the recommended burst size for a 10 Mbps shaped link?** - A) 8,000 bytes - B) 40,000 bytes - C) 80,000 bytes - D) 800,000 bytes <details> <summary>Answer</summary> <b>C) 80,000 bytes</b> - 10 Mbps ร 64 ms = 80,000 bytes. </details> **11. Which QoS tool is better suited for meeting a service provider's CIR?** - A) Policing - B) Shaping - C) Marking - D) WRED <details> <summary>Answer</summary> <b>B) Shaping</b> - Shaping smooths bursts to match CIR and avoid packet drops. </details> **12. What happens to traffic that exceeds the PIR?** - A) Transmitted - B) Buffered - C) Dropped - D) Remarked <details> <summary>Answer</summary> <b>C) Dropped</b> - Traffic exceeding PIR is typically dropped (violate action). </details> --- ## ๐ Next Steps After completing Video 44, you should be ready for: - **Video 45:** QoS Configuration Examples - **Video 46:** CDP and LLDP **Lab Practice:** 1. Configure policing to limit inbound traffic to 10 Mbps 2. Configure shaping to limit outbound traffic to 5 Mbps 3. Verify with `show policy-map interface` 4. Test with traffic generator 5. Configure hierarchical QoS (shaping + LLQ) 6. Compare policing vs. shaping with bursty traffic --- **Ready for Video 45?** Share the link or say "next" and I'll continue with QoS Configuration Examples. I'll continue with **Video 45: QoS Configuration Examples** based on the standard CCNA 200-301 curriculum. ---