Overview
I keep having those days where I don’t configure Cisco networking gear and I forget small details regarding it’s operation. Will start creating these posts as I forget things. But, oh well.
Today’s lack of recall is regarding configuring a range of ports on a Cisco Switch. But, this should also work on other Cisco devices that utilize the CLI. Such as routers.
The switch needed the same configuration between something like
gigabitEthernet 1/0/14
through gigabitEthernet 1/0/25
. Configuration
required was to put it into a VLAN and configure STP on the ports. Merely describing
this for context. I’m not going to provide the actual configuration for the ports.
Note that this isn’t the only scenario that can apply to this need. The range command can apply to many in fact. I’m merely providing this as an example.
Configuration
Connected using SSH. I didn’t use the console port on the switch. To get started,
issue the configure terminal
command to enter configuration mode.
Switch# configure terminal
Below is the command that puts you into the interface configuration mode. There are
other options for this. But, this is what I’m explaining for the current scenario. I’ll
provide more context later. The command will put us in interface configuration mode for
the ports gig1/0/14
through gig1/0/25
.
Switch(config)# interface range gigabitethernet 1/0/14 - 25
Below is the expected prompt after running the command.
Switch(config-if-range)#
More Context
When I mentioned there’s other functionality for configuring a range of ports. I was saying there isn’t much limitation as to a specific range. One can skip ports and follow through into another range as long as those ports require the same configuration.
I will provide an example of this below. Using a comma (,) ports can be skipped to say
gig1/0/30
through gig1/0/40
. This is so we don’t configure ports we shouldn’t be.
Switch(config)# interface range gigabitethernet 1/0/14 - 25 , gigabitethernet 1/0/30 - 40
References
Below is a list of links to Cisco documentation for reference.