Courseiva
SystemGlobal Config

interface range

Bulk-configure multiple switch ports with the same settings in a single command sequence, saving time on large switch configurations.

Definition: interface range is a Cisco IOS global config command. Enters interface range configuration mode, allowing the same commands to be applied to multiple interfaces simultaneously instead of configuring each port individually.

Overview

The `interface range` command in Cisco IOS allows network engineers to configure multiple interfaces of the same type simultaneously, using a range or comma-separated list. This command is essential for bulk configuration changes, such as assigning VLAN membership, setting port security, or enabling spanning-tree features across several ports at once. Instead of entering each interface individually and repeating the same commands, `interface range` streamlines the process, reducing configuration time and minimizing the risk of human error.

The command operates in global configuration mode and requires privilege level 15 (enable mode). When executed, the router or switch enters a sub-configuration mode where all subsequent commands apply to every interface in the specified range. It is important to note that the command does not support mixing different interface types (e.g., FastEthernet and GigabitEthernet) in a single range; each range must be of the same type.

Additionally, the command can be used with a comma to specify non-consecutive interfaces (e.g., `interface range gigabitethernet 1/0/1-5, gigabitethernet 1/0/10`). The command is widely used in campus LAN environments, data center access layers, and branch office configurations. It fits into the broader workflow of initial device provisioning, bulk VLAN assignments, and security policy enforcement.

Understanding `interface range` is critical for CCNA and CCNP candidates as it appears in many configuration scenarios and troubleshooting tasks. The command's output is not buffered; changes are applied immediately to the running configuration. However, caution is required because misapplying a command to a range can affect multiple interfaces, potentially causing network outages.

Alternatives include using a script or automation tool like Ansible, but `interface range` remains the quickest method for manual bulk changes. In terms of IOS behavior, the command supports both hyphenated ranges (e.g., 1-5) and comma-separated lists, but the interfaces must be of the same type and on the same device. The command is available in all major IOS versions, including IOS 12.x, 15.x, and 16.x, as well as IOS-XE.

For NX-OS, the equivalent is `interface ethernet 1/1-5` without the `range` keyword. The command is not available on ASA or IOS-XR platforms. Overall, `interface range` is a powerful tool for efficient interface configuration and is a staple in the network engineer's toolkit.

Syntax·Global Config
interface range <interface-type> <start> - <end> [, <interface-type> <start> - <end>]

When to Use This Command

  • Configure 24 access ports with the same VLAN, spanning-tree portfast, and security settings in one block
  • Shut down multiple ports simultaneously during maintenance
  • Apply QoS or storm control settings to a range of ports at once
  • Configure port security on all access ports in one step

Parameters

ParameterSyntaxDescription
typeFastEthernet | GigabitEthernet | TenGigabitEthernet | etc.Specifies the interface type. Must match the interface type on the device (e.g., GigabitEthernet, FastEthernet). Common mistake: using a different type than the physical interfaces, which results in an invalid input error.
range<slot/port>[-<slot/port>][,<slot/port>[-<slot/port>]]Defines the range of interfaces using a hyphen for consecutive ports or a comma for non-consecutive ports. For modular switches, include the module number (e.g., 1/0/1-5). Common mistake: forgetting the hyphen or using spaces incorrectly (e.g., '1 - 5' instead of '1-5').

Command Examples

Configure ports 1-24 as access ports on VLAN 10

Switch(config)# interface range GigabitEthernet1/0/1 - 24
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# spanning-tree portfast
Switch(config-if-range)# shutdown
Switch(config-if-range)# end

Non-contiguous ranges with comma separator

Switch(config)# interface range GigabitEthernet1/0/1 - 12 , GigabitEthernet1/0/14 - 24
Switch(config-if-range)# switchport mode access

Understanding the Output

The prompt changes to (config-if-range)# indicating multiple interfaces are selected. All commands entered apply to every interface in the range simultaneously. Use show interfaces status or show running-config to verify configuration was applied correctly.

Configuration Scenarios

Bulk VLAN Assignment to Access Ports

A network administrator needs to assign VLAN 10 to multiple access ports on a switch to segment a department's traffic. Using interface range saves time and ensures consistency.

Topology

Switch1(Gi1/0/1-24)---PCs (VLAN 10)

Steps

  1. 1.Step 1: Enter global configuration mode: Switch> enable
  2. 2.Step 2: Enter privileged EXEC mode: Switch# configure terminal
  3. 3.Step 3: Specify the interface range: Switch(config)# interface range gigabitethernet 1/0/1-24
  4. 4.Step 4: Set the interface mode to access: Switch(config-if-range)# switchport mode access
  5. 5.Step 5: Assign VLAN 10: Switch(config-if-range)# switchport access vlan 10
  6. 6.Step 6: Exit interface range mode: Switch(config-if-range)# exit
Configuration
! Bulk VLAN assignment
Switch(config)# interface range gigabitethernet 1/0/1-24
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# exit

Verify: Use 'show interfaces status' or 'show vlan brief' to verify that interfaces Gi1/0/1-24 are in VLAN 10 and in access mode.

Watch out: If any interface in the range is already configured as a trunk, the 'switchport mode access' command will fail on that interface. Ensure all interfaces are in the desired state before applying the range.

Enabling PortFast and BPDU Guard on Multiple Edge Ports

To prevent spanning-tree delays on ports connected to end devices, the administrator enables PortFast and BPDU guard on all access ports. Using interface range applies these settings quickly.

Topology

Switch1(Gi1/0/1-12)---End Devices

Steps

  1. 1.Step 1: Enter global configuration mode: Switch> enable
  2. 2.Step 2: Enter privileged EXEC mode: Switch# configure terminal
  3. 3.Step 3: Specify the interface range: Switch(config)# interface range gigabitethernet 1/0/1-12
  4. 4.Step 4: Enable PortFast: Switch(config-if-range)# spanning-tree portfast
  5. 5.Step 5: Enable BPDU guard: Switch(config-if-range)# spanning-tree bpduguard enable
  6. 6.Step 6: Exit interface range mode: Switch(config-if-range)# exit
Configuration
! Enable PortFast and BPDU guard
Switch(config)# interface range gigabitethernet 1/0/1-12
Switch(config-if-range)# spanning-tree portfast
Switch(config-if-range)# spanning-tree bpduguard enable
Switch(config-if-range)# exit

Verify: Use 'show spanning-tree interface gigabitethernet 1/0/1 detail' to verify PortFast and BPDU guard are enabled.

Watch out: PortFast should only be enabled on ports connected to end devices, not on ports connecting to other switches. Enabling it on inter-switch links can cause temporary loops.

Troubleshooting with This Command

When troubleshooting interface configurations applied via `interface range`, the first step is to verify that the correct interfaces were targeted. Use `show running-config | section interface` to review the configuration block. If a command fails on one interface in the range, the entire range command may fail, depending on the IOS version.

For example, if you attempt to set `switchport access vlan 10` on a range that includes a trunk port, the command will fail on that trunk port, and the configuration may not be applied to any interface in the range. To isolate the issue, use `show interfaces status` to check the operational mode of each interface. Another common symptom is that after applying a range command, some interfaces do not show the expected configuration.

This can happen if the range syntax was incorrect (e.g., using a comma instead of a hyphen for consecutive ports). Use `show interfaces description` to list all interfaces and verify which ones were included. If a command like `spanning-tree portfast` is applied but does not take effect, check if the interface is already in a different spanning-tree mode (e.g., trunk).

Use `show spanning-tree interface <interface> detail` to see the current settings. For bulk VLAN assignments, if a port remains in the default VLAN, verify that the interface is not in trunk mode with `show interfaces trunk`. Additionally, if you are using a comma-separated list, ensure there is no space after the comma (e.g., `interface range gigabitethernet 1/0/1-5,gigabitethernet 1/0/10` is correct; a space after the comma may cause a syntax error).

When troubleshooting, also check the privilege level; the command requires privilege level 15. Use `show privilege` to confirm. Finally, if the device is a stack or chassis, ensure the interface range includes the correct module numbers.

A common mistake is to omit the module number on modular switches, leading to an 'Invalid input detected' error. Use `show ip interface brief` to list all interfaces with their correct identifiers. By following these steps, you can quickly identify and resolve issues related to `interface range` configurations.

CCNA Exam Tips

1.

CCNA exam: space is required between the interface number and the dash, and between the dash and the end number (GigabitEthernet1/0/1 - 24 not GigabitEthernet1/0/1-24)

2.

Comma with a space separates non-contiguous ranges

3.

Works with FastEthernet, GigabitEthernet, and all other interface types

Common Mistakes

Missing the space before and after the dash (IOS returns an error)

Using interface range on router interfaces with different module/slot numbers (must be same slot)

Forgetting that commands apply to ALL ports in range — double-check the range before applying destructive commands like shutdown

interface range vs switchport mode access

The commands 'interface range' and 'switchport mode access' are commonly confused because they are frequently used together when configuring multiple access ports. However, they serve distinct purposes: 'interface range' is a global configuration command that enters a submode to configure a set of interfaces simultaneously, while 'switchport mode access' is an interface-level command that sets the port to access mode with no trunk negotiation.

Aspectinterface rangeswitchport mode access
ScopeApplies to a group of interfaces via a rangeApplies to a single interface (or each in range)
Configuration ModeGlobal configuration modeInterface configuration mode
Effect on DTPNo direct effect; DTP negotiation still occurs if not overriddenDisables DTP, preventing trunk negotiation
PersistencePersistent only when combined with subsequent commandsPersistent as part of the interface configuration
Typical UseBatch configuration of multiple interfacesSetting a port to access VLAN mode

Use interface range when you need to apply the same configuration commands to multiple interfaces simultaneously, such as setting all ports in a range to access mode.

Use switchport mode access when you need to statically define a switch port as an access port and disable trunk negotiation.

Platform Notes

In IOS-XE, the `interface range` command behaves identically to classic IOS, but the syntax for interface naming may differ on newer platforms (e.g., `GigabitEthernet` vs `GigabitEthernet`). On Catalyst 9000 series switches running IOS-XE 16.x, the command is fully supported. In NX-OS, the equivalent is simply `interface ethernet 1/1-5` without the `range` keyword; NX-OS automatically interprets a hyphen as a range.

For example, `interface ethernet 1/1-5` enters interface range configuration mode. NX-OS also supports comma-separated lists. On ASA firewalls, there is no direct equivalent; interface configuration is done individually or via object groups, but not with a range command.

In IOS-XR, the `interface range` command is not available; instead, you can use the `interface` command with a range using the `range` keyword in some versions, but it is not as straightforward. For example, `interface GigabitEthernet0/0/0/0-5` may work in some IOS-XR versions, but it is not universally supported. In general, for IOS-XR, bulk configuration is done via configuration groups or commit-based changes.

For CCNA and CCNP candidates, it is important to know that `interface range` is primarily a Cisco IOS and IOS-XE feature, and its usage on other platforms may vary. Always verify the specific platform documentation.

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