Configuration Guide
162
Configuring 802.1Q VLAN
Configuration Example
3.5 Using the CLI
The configurations of Switch 1 and Switch 2 are similar. The following introductions take
Switch 1 as an example.
1) Create VLAN 10 for Department A, and configure the description as Department-A.
Similarly, create VLAN 20 for Department B, and configure the description as
Department-B.
Switch_1#configure
Switch_1(config)#vlan 10
Switch_1(config-vlan)#name Department-A
Switch_1(config-vlan)#exit
Switch_1(config)#vlan 20
Switch_1(config-vlan)#name Department-B
Switch_1(config-vlan)#exit
2) Set the port mode of port 1/0/2 and port 1/0/3 as Untagged, and then add port 1/0/2 to
VLAN 10 and add port 1/0/3 to VLAN 20.
Switch_1(config)#interface gigabitEthernet 1/0/2
Switch_1(config-if)#switchport general allowed vlan 10 untagged
Switch_1(config-if)#exit
Switch_1(config)#interface gigabitEthernet 1/0/3
Switch_1(config-if)#switchport general allowed vlan 20 untagged
Switch_1(config-if)#exit
3) Set the port mode of port 1/0/4 as Tagged, and then add it to both VLAN 10 and VLAN
20.
Switch_1(config)#interface gigabitEthernet 1/0/4
Switch_1(config-if)#switchport general allowed vlan 10,20 tagged
Switch_1(config-if)#end
Switch_1#copy running-config startup-config
Verify the Configurations
Switch_1#show vlan
VLAN Name Status Ports
-------------------------------------------------------------
1 Default VLAN active Gi1/0/1, Gi1/0/2, Gi1/0/3, Gi1/0/4,