06-09-2016 11:59 PM - edited 03-08-2019 06:08 AM
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
06-10-2016 12:53 AM
Hi Naveen
yes you can use the range command
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
interface range g0/1 - 24
switchport access vlan 2
switchport mode access
06-10-2016 02:42 AM
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?
06-10-2016 02:53 AM
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
06-10-2016 03:31 AM
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?
06-10-2016 04:52 AM
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
06-10-2016 01:30 AM
hi,
you can do this:
int range f0/1-3
switchport host
switchport access vlan 10
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide