CCIE Pursuit Blog

June 7, 2007

Interface Range: Wax On. Wax Off.

Filed under: Cool Commands,IOS,Tech Tips — cciepursuit @ 4:02 pm

If you need to configure a number of interfaces at the same (common with switches) you can use the “interface range” command: 

Using the Interface Range Command To Add to the Config:
sw1(config)#interface range fa0/13 – 15
sw1(config-if-range)#desc -> type some stuff
sw1(config-if-range)#exit

Verify the Configuration:
sw1(config)#do sh run int fa0/13
Building configuration…

Current configuration : 63 bytes
!
interface FastEthernet0/13
 description -> type some stuff
end

sw1(config)#do sh run int fa0/14
Building configuration…

Current configuration : 63 bytes
!
interface FastEthernet0/14
 description -> type some stuff
end

sw1(config)#do sh run int fa0/15
Building configuration…

Current configuration : 63 bytes
!
interface FastEthernet0/15
 description -> type some stuff
end

Most people are aware of this application of the Interface Range command.  The only tricky part is to remember to keep a space on either side of the hyphen:

Right:
interface range fa0/1 – 10

Wrong:
interface range fa0/1-10

When you’re doing labs(especially short labs), you will often need to reverse your changes.  A lot of times you will simply default the interface:

Default the Interface:
sw1(config)#default int fa0/1

This is a great time saver, but can we use the Interface Range command to default a bunch of interfaces at once?  Sure we can:

Using Default with Interface Range:
sw1(config)#default inter range fa0/13 – 15
sw1(config)#do sh run int fa0/13
Building configuration…

Current configuration : 34 bytes
!
interface FastEthernet0/13
end

sw1(config)#do sh run int fa0/14
Building configuration…

Current configuration : 34 bytes
!
interface FastEthernet0/14
end

sw1(config)#do sh run int fa0/15
Building configuration…

Current configuration : 34 bytes
!
interface FastEthernet0/15
end

NICE!!!  This is a great time-saver over defaulting each interface or using “write erase” and “reload”.

One last note: you can always pop of interface range mode (config-if-range) by using exit, control + z, or just typing a command that is not applicable at the interface level, such as:

From Interface Range to Interface Level:
sw1(config-if-range)#int po1
% Command exited out of interface range and its sub-modes.
  Not executing the command for second and later interfaces

Cisco Documentation:

Interface Range

Create a free website or blog at WordPress.com.