S1>enable
S1#configure terminal
#创建VLAN20
S1(config)#vlan 20
S1(config-vlan)#name VLAN20
#创建VLAN30
S1(config-vlan)#vlan 30
S1(config-vlan)#name VLAN30
S1(config-vlan)#exit
#把F0/4~F0/7指派给VLAN20
S1(config)#interface f0/4
S1(config-if)#switchport access vlan 20
S1(config-if)#interface f0/5
S1(config-if)#switchport access vlan 20
S1(config-if)#interface f0/6
S1(config-if)#switchport access vlan 20
S1(config-if)#interface f0/7
S1(config-if)#switchport access vlan 20
#把F0/8~F0/11指派给VLAN30
S1(config-if)#interface f0/8
S1(config-if)#switchport access vlan 30
S1(config-if)#interface f0/9
S1(config-if)#switchport access vlan 30
S1(config-if)#interface f0/10
S1(config-if)#switchport access vlan 30
S1(config-if)#interface f0/11
S1(config-if)#switchport access vlan 30
#把F0/12配置为Trunk模式
S1(config-if)#interface f0/12
S1(config-if)#switchport mode trunk
S1(config-if)#end
#查看配置结果
S1#show vlan
#保存配置
S1#copy running-config startup-config
S2>enable
S2#configure terminal
#创建VLAN30
S2(config)#vlan 30
S2(config-vlan)#name VLAN30
S2(config-vlan)#exit
#把F0/1~F0/5指派给VLAN30
S2(config)#interface range f0/1-5
S2(config-if)#switchport access vlan 30
#把F0/12配置为Trunk模式
S2(config-if)#interface f0/12
S2(config-if)#switchport mode trunk
S2(config-if)#end
#查看配置结果
S2#show vlan
#保存配置
S2#copy running-config startup-config