Back to Command Reference
Global ConfigDomain 3.0

interface range

Allows an administrator to group multiple physical or logical interfaces together and apply configuration commands to all of them simultaneously. This is an essential tool for rapid switch provisioning and adhering to bulk security policies.

Quick Reference

Execution ModeSwitch(config)#
Submode PromptSwitch(config-if-range)#
Separator LogicHyphen (-) for blocks. Comma (,) for lists.
Macro Alternativedefine interface-range [name]

Syntax & Parameters

interface range [type] [start] - [end]
Formatting RulesDescription & Examples
Hyphenated BlocksUsed to select a contiguous block of ports.
int range g0/1 - 24
Comma Separated ListsUsed to select non-contiguous ports or mix entirely different interface types. You must specify the interface type again after the comma.
int range fa0/1 - 12, gi0/1 - 2

CLI Deployment Scenarios

Scenario 1: Mass Edge Port Provisioning

You are configuring a new 48-port access switch. Ports 1 through 40 are going to be standard user wall jacks assigned to the Data VLAN (10).

Switch(config)# interface range g1/0/1 - 40
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# spanning-tree portfast
! All 40 ports are instantly configured with these three commands.

Scenario 2: The Network Security Lockdown

A standard CCNA security best practice is to proactively shut down all unused ports on a switch to prevent unauthorized physical access.

Switch(config)# interface range g1/0/41 - 48
Switch(config-if-range)# shutdown
%LINK-5-CHANGED: Interface GigabitEthernet1/0/41, changed state to administratively down
... (repeats for ports 42 through 48)

CCNA Exam Gotchas

[!]

The Invalid Input Hyphen Trap

In many older versions of Cisco IOS (and specifically in the Packet Tracer simulator used for CCNA prep), you must put a space before and after the hyphen.

Typing int range g0/1-24 will fail with an "Invalid input" marker at the hyphen.
You must type int range g0/1 - 24.

[!]

The Comma Reset Error

When using a comma to separate lists, you cannot just list numbers. If you type int range g0/1 - 5, 10 - 15 the switch will reject it because it doesn't know what type of port "10" is. You must re-declare the interface type after every comma: int range g0/1 - 5, g0/10 - 15.