First off let me say that its really good practice to configure ports one by one, at least when you are starting out in the network world, as the repetition of typing the same thing over and over helps you to remember the proper commands. Hell this is one of the reasons that I blog the stuff that I do… I'm trying to make sure that I do not forget what I just learned.
Anyway, this is a quick and dirty one that I cannot remember to save my life. In this instance I wanted to configure a few ports on a 2950 that I plan to use to replace my 2960, as my 2960 is destined for bigger and better things given its layer 3 capabilities.
Note the spaces between the first port in the range, the dash, and the last port in the range.
s-2950-1.localdomain(config)#interface range fastEthernet 0/9 – 16
s-2950-1.loc(config-if-range)#description vlan 1 ports
s-2950-1.loc(config-if-range)#switchport mode access
s-2950-1.loc(config-if-range)#switchport access vlan 1
s-2950-1.loc(config-if-range)#spanning-tree portfast%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc… to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION%Portfast will be configured in 8 interfaces due to the range command
but will only have effect when the interfaces are in a non-trunking mode.s-2950-1.loc(config-if-range)#spanning-tree bpduguard enable
s-2950-1.loc(config-if-range)#end
s-2950-1.localdomain#copy run start
Related articles