interface range command

The interface range command allows you to configure multiple interfaces at once. The interface range command is particularly useful because switches have many interfaces and the same settings are often applied to multiple interfaces.

interface range command format

The format of the interface range command is as follows: range should be specified with “-” (hyphen).

interface range command

(config)#interface range <interface-type> <slot>/<port > – <port>
(config-if-range)#

To configure multiple non-contiguous interfaces at once, delimit them with a comma (“,”). After separating with a comma, you need to specify the interface from .

interface range command non-contiguous interfaces

(config)#interface range <interface-type> <slot>/<port > , <interface-type> <slot>/<port >
(config-if-range)#

It is also possible to combine a consecutive interfaces with “-” and non-consecutive interfaces with a “,”.

interface range command example

The following is an example of entering the shutdown command from GigabitEthernet0/1 to GigabitEthernet0/3 and GigabitEthernet0/5 all at once.

Switch(config)#interface range GigabitEthernet 0/1-3, GigabitEthernet 0/5
Switch(config-if-range)#shutdown
Switch(config-if-range)#do show run int gi 0/1
Building configuration...

Current configuration : 48 bytes
!
interface GigabitEthernet0/1
 shutdown
end

Switch(config-if-range)#do show run int gi 0/2
Building configuration...

Current configuration : 48 bytes
!
interface GigabitEthernet0/2
 shutdown
end

Switch(config-if-range)#do show run int gi 0/3
Building configuration...

Current configuration : 48 bytes
!
interface GigabitEthernet0/3
 shutdown
end

Switch(config-if-range)#do show run int gi 0/5
Building configuration...

Current configuration : 48 bytes
!
interface GigabitEthernet0/5
 shutdown
end

Cisco Basic