cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1297
Views
0
Helpful
6
Replies

Shortcuts for Creating VLAN

naveen.bodhula1
Level 1
Level 1

Is there is any shortcuts for creating VLAN for number of ports at a time.

Not like this:

int fa0/1

switchport mode access 

switchport access vlan 10

int fa0/2

switchport mode access 

switchport access vlan 10

int fa0/3

switchport mode access 

switchport access vlan 10

So I want to give interfaces 1,2,3 to vlan 10 with only one command.

TIA

6 Replies 6

Mark Malone
VIP Alumni
VIP Alumni

Hi Naveen

yes you can use the range command

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

interface range g0/1 - 24

switchport access vlan 2

switchport mode access

Hi,

Thanks fro the reply

Is 'switchport mode access' is mandatory  command. Even if we didn't execute it, the vlans are creating, then what is the purpose of it?

Hi ports are dynamic desirable on certain platforms by default , this command prevents it ever trying to negotiate or be anything like a trunk ., its best practice to assign it as access so it always behaves that way if its going to be an access port

Hi,

And what is the shortcut if I wanted to assign same VLAN to port numbers such as 1,3,5,7 with single command?

 the range command is how you do all interfaces , you can use just the switchport access vlan x command it will work fine but if you want to do best practice by Cisco use the 2 commands above , that's as short as it gets in terms of syntax , it just means if you use the one command and someone disconnects your pc and sticks in a switch it may forma trunk depending so for security ad best practice you use the 2 commands

Whenever a port is access like pc or printer etc connected you should always use spanning-tree portfast and spanning-tree bpduguard under your access ports as well another best practice

johnlloyd_13
Level 9
Level 9

hi,

you can do this:

int range f0/1-3

switchport host

switchport access vlan 10

Review Cisco Networking products for a $25 gift card