Switch>en
Switch>enable
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#name lol
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name dnf
Switch(config-vlan)#exit
Switch(config)#exit
Switch#configure t
Switch(config)#interface f0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vl 10
Switch(config-if)#exit
Switch(config)#interface f0/4
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vl 20
Switch(config-if)#exit
Switch#show vlan ---------------查看VLAN已配置信息
Switch(config)#interface f0/24
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 10,20
Switch(config-if)#end
Switch#show interfaces trunk ------->查看端口的trunk模式
Port Mode Encapsulation Status Native vlan ------------显示结果
Fa0/24 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/24 10,20
Port Vlans allowed and active in management domain
Fa0/24 10,20
Port Vlans in spanning tree forwarding state and not pruned
Fa0/24 10,20
Switch#
switch1 VLAN 配置完成
switch2 同理
可以在PC机上互相ping,验证试验结果。