Courseiva
QoSPolicy-map Class Config

bandwidth [kbps|percent n]

The bandwidth command in policy-map class configuration mode allocates a minimum bandwidth guarantee (in kbps or as a percentage) to a specific traffic class during congestion, ensuring QoS for critical applications.

Definition: bandwidth [kbps|percent n] is a Cisco IOS policy-map class config command. The bandwidth command in policy-map class configuration mode allocates a minimum bandwidth guarantee (in kbps or as a percentage) to a specific traffic class during congestion, ensuring QoS for critical applications.

Overview

The `bandwidth` command in policy-map class configuration mode is a fundamental Quality of Service (QoS) tool used to guarantee a minimum amount of bandwidth to a specific traffic class during periods of congestion. This command is critical for ensuring that important applications—such as voice, video, or critical business data—receive the necessary resources to function properly, even when the network link is oversubscribed. The underlying concept is that of bandwidth reservation: the router allocates a specified amount of bandwidth (either in kbps or as a percentage of the interface bandwidth) to the class, and during congestion, it will attempt to provide at least that amount.

This is distinct from policing, which drops traffic exceeding a limit, or shaping, which buffers excess traffic. The `bandwidth` command is used within a policy map, which is applied to an interface in the output direction. It is typically employed in conjunction with other QoS tools like `priority` (for strict priority queuing) or `fair-queue` (for flow-based fairness).

A common alternative is the `priority` command, which provides strict priority queuing but can starve other classes; `bandwidth` is more suitable for classes that need a guaranteed minimum but can tolerate some delay. In the broader configuration workflow, you first define a class map to match traffic, then create a policy map to assign actions (like `bandwidth`), and finally apply the policy map to an interface. Important IOS behavior: the `bandwidth` command is only effective when the interface is congested; if there is no congestion, the class can use more than its allocated bandwidth.

The command is available in privileged EXEC mode (config-pmap-c) and requires appropriate privilege levels (typically 15). Changes take effect immediately and are saved to the running configuration. The command can be used with both the `percent` keyword (relative to interface bandwidth) or an absolute kbps value.

When using `percent`, the router calculates the bandwidth based on the interface's configured bandwidth (which may differ from actual line rate). A common mistake is to oversubscribe the total bandwidth across all classes, which can lead to unexpected drops. The command also interacts with the `shape` command; if shaping is configured, the bandwidth guarantee is relative to the shaped rate.

Understanding this command is essential for CCNA and CCNP candidates as it appears in QoS topics and troubleshooting scenarios.

Syntax·Policy-map Class Config
bandwidth [kbps|percent n]

When to Use This Command

  • Guarantee 1 Mbps for VoIP traffic in a WAN link to prevent jitter and packet loss.
  • Allocate 50% of interface bandwidth to mission-critical database replication traffic.
  • Reserve 256 kbps for network management traffic (SNMP, syslog) to ensure reachability during congestion.
  • Shape video streaming traffic to 2 Mbps to prevent starvation of other classes.

Parameters

ParameterSyntaxDescription
kbps<1-10000000>Specifies the guaranteed bandwidth in kilobits per second. Valid values range from 1 to 10,000,000 kbps. Common mistake: setting a value higher than the interface bandwidth or oversubscribing total bandwidth across classes.
percentpercent <1-100>Specifies the guaranteed bandwidth as a percentage of the interface bandwidth (or shaped rate if shaping is configured). Valid values are 1 to 100. Common mistake: using percent without ensuring the total percentage across classes does not exceed 100 (or 75 for some platforms).

Command Examples

Allocate bandwidth in kbps for VoIP class

bandwidth 1000
Router(config-pmap-c)# bandwidth 1000
Router(config-pmap-c)#

The command assigns a minimum of 1000 kbps (1 Mbps) to the traffic class. No output is shown if successful; the prompt returns without error.

Allocate bandwidth as a percentage of interface bandwidth

bandwidth percent 30
Router(config-pmap-c)# bandwidth percent 30
Router(config-pmap-c)#

This reserves 30% of the interface bandwidth for the class. The percentage is relative to the interface bandwidth configured with the 'bandwidth' interface command.

Understanding the Output

The bandwidth command does not produce direct output; it silently configures the policy. To verify, use 'show policy-map [policy-name]' or 'show policy-map interface [interface]'. In the output of 'show policy-map interface', look for the 'Bandwidth' field under each class.

For example: 'Bandwidth 1000 (kbps)' indicates a guaranteed 1000 kbps. If the value is lower than expected, check the interface bandwidth or total allocated bandwidth (cannot exceed interface bandwidth). A common issue is oversubscription: if the sum of bandwidths exceeds 100% (or interface bandwidth), the router will reject the policy-map with an error during attachment.

Also, note that the 'bandwidth' command is only effective during congestion; if the link is not congested, classes can exceed their allocated bandwidth.

Configuration Scenarios

Guarantee bandwidth for VoIP traffic on a WAN link

A branch office has a 1.544 Mbps T1 link to headquarters. VoIP traffic must have at least 512 kbps guaranteed to ensure call quality, while other traffic can share the remaining bandwidth.

Topology

BranchRouter(Gi0/0)---1.544 Mbps T1---(Gi0/0)HQRouter

Steps

  1. 1.Step 1: Enter global configuration mode: BranchRouter# configure terminal
  2. 2.Step 2: Create a class map to match VoIP traffic (assuming DSCP EF): BranchRouter(config)# class-map match-any VOIP
  3. 3.Step 3: Match on DSCP EF: BranchRouter(config-cmap)# match ip dscp ef
  4. 4.Step 4: Exit class-map configuration: BranchRouter(config-cmap)# exit
  5. 5.Step 5: Create a policy map: BranchRouter(config)# policy-map QOS_POLICY
  6. 6.Step 6: Define the VoIP class: BranchRouter(config-pmap)# class VOIP
  7. 7.Step 7: Allocate bandwidth: BranchRouter(config-pmap-c)# bandwidth 512
  8. 8.Step 8: Exit class configuration: BranchRouter(config-pmap-c)# exit
  9. 9.Step 9: Define default class for other traffic: BranchRouter(config-pmap)# class class-default
  10. 10.Step 10: (Optional) Use fair-queue for default class: BranchRouter(config-pmap-c)# fair-queue
  11. 11.Step 11: Exit policy-map configuration: BranchRouter(config-pmap-c)# exit
  12. 12.Step 12: Apply policy-map to the WAN interface (outbound): BranchRouter(config)# interface gigabitethernet0/0
  13. 13.Step 13: Apply service policy: BranchRouter(config-if)# service-policy output QOS_POLICY
  14. 14.Step 14: Exit and save: BranchRouter(config-if)# end; BranchRouter# write memory
Configuration
! Full IOS config block
class-map match-any VOIP
 match ip dscp ef
!
policy-map QOS_POLICY
 class VOIP
  bandwidth 512
 class class-default
  fair-queue
!
interface GigabitEthernet0/0
 bandwidth 1544
 service-policy output QOS_POLICY

Verify: Use 'show policy-map interface gigabitethernet0/0' to verify. Expected output shows the VOIP class with 'Bandwidth 512 (kbps)' and counters for offered and dropped packets.

Watch out: Ensure the interface bandwidth is set correctly with the 'bandwidth' command under the interface; otherwise, the router may use default bandwidth (e.g., 1 Gbps for GigabitEthernet) leading to incorrect percentage calculations if using percent.

Allocate bandwidth as a percentage on a shaped link

A router shapes traffic to 10 Mbps on a 100 Mbps Ethernet interface. You need to guarantee 30% of the shaped rate (3 Mbps) for mission-critical data traffic.

Topology

Router(Gi0/0)---100 Mbps Ethernet---(Gi0/0)ISP

Steps

  1. 1.Step 1: Enter global configuration mode: Router# configure terminal
  2. 2.Step 2: Create class map for critical data: Router(config)# class-map match-any CRITICAL_DATA
  3. 3.Step 3: Match on ACL or DSCP: Router(config-cmap)# match ip dscp af21
  4. 4.Step 4: Exit: Router(config-cmap)# exit
  5. 5.Step 5: Create policy map: Router(config)# policy-map SHAPED_QOS
  6. 6.Step 6: Define class: Router(config-pmap)# class CRITICAL_DATA
  7. 7.Step 7: Allocate bandwidth as percentage: Router(config-pmap-c)# bandwidth percent 30
  8. 8.Step 8: Exit: Router(config-pmap-c)# exit
  9. 9.Step 9: Define default class: Router(config-pmap)# class class-default
  10. 10.Step 10: (Optional) Set bandwidth for default: Router(config-pmap-c)# bandwidth percent 70
  11. 11.Step 11: Exit policy-map: Router(config-pmap-c)# exit
  12. 12.Step 12: Apply shaping under the interface: Router(config)# interface gigabitethernet0/0
  13. 13.Step 13: Configure shaping: Router(config-if)# shape average 10000000
  14. 14.Step 14: Apply service policy: Router(config-if)# service-policy output SHAPED_QOS
  15. 15.Step 15: Exit and save: Router(config-if)# end; Router# write memory
Configuration
! Full IOS config block
class-map match-any CRITICAL_DATA
 match ip dscp af21
!
policy-map SHAPED_QOS
 class CRITICAL_DATA
  bandwidth percent 30
 class class-default
  bandwidth percent 70
!
interface GigabitEthernet0/0
 bandwidth 100000
 shape average 10000000
 service-policy output SHAPED_QOS

Verify: Use 'show policy-map interface gigabitethernet0/0' to verify. Look for 'Bandwidth 30% (3000 kbps)' under the CRITICAL_DATA class. Also check 'show interface gigabitethernet0/0' to confirm shaping rate.

Watch out: When using 'bandwidth percent' under a shaped policy, the percentage is relative to the shaped rate, not the interface bandwidth. Ensure the total percentage across all classes does not exceed 100; otherwise, the router may reject the policy.

Troubleshooting with This Command

When troubleshooting the `bandwidth` command, the primary verification tool is `show policy-map interface [interface-name]`. This command displays per-class statistics including offered rate, drop rate, and the bandwidth guarantee. Healthy output shows that the bandwidth allocated to each class matches the configured value, and drop counters are low or zero for classes that are within their guarantee.

Problem indicators include: (1) high drop counters for a class that should have a guarantee, suggesting that the total bandwidth is oversubscribed or the class is exceeding its allocated share; (2) the 'Bandwidth' field showing a value different from what was configured, which may indicate that the interface bandwidth was changed or shaping is active; (3) the 'Queue depth' growing large, indicating congestion that the bandwidth guarantee cannot alleviate. Focus on the 'Offered rate' and 'Drop rate' fields: if the offered rate exceeds the bandwidth guarantee and drops are occurring, the class is being policed implicitly (though `bandwidth` does not police, it guarantees; drops happen if the queue is full). A common symptom is voice quality issues despite a bandwidth guarantee; this often points to incorrect classification (e.g., DSCP not matching) or the policy not being applied to the correct interface/direction.

The diagnostic flow: first, verify the policy-map is applied with `show running-config | section policy-map` and `show policy-map interface`. Second, check the class-map matches with `show class-map` and `show access-lists` if used. Third, examine interface congestion with `show interface [interface]` for output drops and queue statistics.

Fourth, use `debug policy-map` (with caution) to see real-time packet classification and actions. Correlate with `show queueing interface` to see hardware queues. If using `bandwidth percent`, ensure the interface bandwidth is set correctly with `show interface [interface] | include BW`.

Also, check for shaping: if `shape` is configured, the bandwidth guarantee is relative to the shaped rate, which can be verified with `show policy-map interface [interface]` under the parent policy. Another useful command is `show policy-map [policy-name]` to see the configured parameters. In summary, the `bandwidth` command is straightforward but requires careful verification of classification, interface bandwidth, and shaping to ensure the guarantee works as intended.

CCNA Exam Tips

1.

CCNA exam tip: The 'bandwidth' command in policy-map class config is used for guaranteed bandwidth, not shaping or policing. Know the difference.

2.

CCNA exam tip: When using 'bandwidth percent', the percentage is based on the interface bandwidth (set with 'bandwidth' interface command), not the actual link speed.

3.

CCNA exam tip: You cannot mix 'bandwidth' and 'bandwidth percent' in the same policy-map; choose one method per class.

4.

CCNA exam tip: The sum of all 'bandwidth' allocations in a policy-map must not exceed the interface bandwidth; otherwise, the policy-map will be rejected.

Common Mistakes

Mistake: Using 'bandwidth' without first configuring a class-map and policy-map. Consequence: The command is ignored or applied to the default class.

Mistake: Allocating more total bandwidth than available on the interface. Consequence: The policy-map will fail to attach with an 'exceeded bandwidth' error.

Mistake: Confusing 'bandwidth' (guarantee) with 'shape average' (traffic shaping). Consequence: Misconfigured QoS leading to incorrect traffic treatment.

bandwidth [kbps|percent n] vs class [class-map-name]

These two commands are often confused because they both appear in policy-map configuration for QoS. The `class` command defines the traffic class and enters its subconfiguration, while the `bandwidth` command is an action applied within that class to allocate minimum bandwidth. Understanding their distinct roles is key to designing effective QoS policies.

Aspectbandwidth [kbps|percent n]class [class-map-name]
ScopeApplies to a single traffic class within a policy-mapDefines and selects a traffic class from class-map
Configuration ModePolicy-map class configuration mode (inside a class)Policy-map configuration mode (global policy-map)
PersistenceValue persists as part of the class configurationCreates the class structure that persists in the policy-map
PrecedenceQoS action applied after classificationClassification step that determines which traffic gets which actions
Typical UseGuarantee minimum bandwidth for critical traffic during congestionEnter class configuration to apply policing, shaping, marking, or bandwidth

Use bandwidth [kbps|percent n] when you need to reserve a minimum amount of bandwidth for a specific traffic class to ensure its performance during congestion.

Use class [class-map-name] when you need to associate a previously defined traffic class with a set of QoS actions (like bandwidth, police, shape, or set) inside a policy-map.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches), the `bandwidth` command syntax is identical to classic IOS, but the output of `show policy-map interface` may include additional fields like 'Queueing' and 'Priority' for hardware offload. On NX-OS (e.g., Nexus switches), the equivalent command is `bandwidth` within a policy-map class, but the configuration is done in a modular QoS CLI (MQC) similar to IOS. However, NX-OS uses `policy-map type qos` and `class-map type qos`; the `bandwidth` command is available under `policy-map type qos`.

For example: `policy-map type qos QOS_POLICY` then `class type qos VOIP` then `bandwidth percent 30`. The verification command is `show policy-map type qos interface [interface]`. On ASA firewalls, QoS is limited; the `bandwidth` command is not directly available.

Instead, ASA uses `priority-queue` and `police` commands for QoS. For IOS versions: In 12.x, the `bandwidth` command was introduced with the MQC framework; in 15.x and 16.x, the syntax remains consistent, but newer platforms may support additional features like `bandwidth remaining` for fair sharing. In IOS-XR, the equivalent is `bandwidth` under a policy-map class, but the configuration is done in a different CLI style (e.g., `policy-map` then `class` then `bandwidth`).

However, IOS-XR uses `bandwidth` with `percent` or `rate` keywords. For example: `policy-map QOS` then `class VOIP` then `bandwidth rate 512 kbps`. Verification uses `show policy-map interface [interface]` similar to IOS.

Overall, the command is widely supported across Cisco platforms with minor syntax variations.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions