Configuring Port-Based VLANs on Device-A
- Enable the privileged EXEC mode and enter the global configuration command.
- Enter the device name.
- Configure a VLAN by assigning an ID to the VLAN and name it.
- Configure VLAN 2 by port.
- Configure the following ports as untagged member of VLAN 2.
- If ports are not a member of the specified VLAN, then add the ports as a tagged member of that VLAN.
- Enable STP using the
spanning-treecommand. - Follow the same steps for other VLANs with the addition of changing the port priority
for VLAN 4 and VLAN 5.
device-A(config-vlan-2)# vlan 3 name GREEN device-A(config-vlan-3)# vlan 3 by port device-A(config-vlan-3)# untagged ethernet 1/1/5 to 1/1/8 ethernet 1/1/18 device-A(config-vlan-3)# tagged ethernet 1/1/25 to 1/1/26 device-A(config-vlan-3)# spanning-tree device-A(config-vlan-3)# vlan 4 name BLUE device-A(config-vlan-4)# vlan 4 by port device-A(config-vlan-4)# untagged ethernet 1/1/9 to 1/1/12 ethernet 1/1/19 device-A(config-vlan-4)# tagged ethernet 1/1/25 to 1/1/26 device-A(config-vlan-4)# spanning-tree device-A(config-vlan-4)# spanning-tree priority 500 device-A(config-vlan-4)# vlan 5 name RED device-A(config-vlan-5)# vlan 5 by port device-A(config-vlan-5)# untagged ethernet 1/1/13 to 1/1/16 ethernet 1/1/20 device-A(config-vlan-5)# tagged ethernet 1/1/25 to 1/1/26 device-A(config-vlan-5)# spanning-tree device-A(config-vlan-5)# spanning-tree priority 500 device-A(config-vlan-5)# end device-A# write memory