1、搭建网络
搭建拓扑、规划IP、划分网段
2、交换机配置
配置脚本(设置trunk和创建vlan很重要)
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//创建vlan20
Switch(config)#vlan 20
Switch(config-vlan)#name vlan20
Switch(config-vlan)#exit
//创建vlan30
Switch(config)#vlan 30
Switch(config-vlan)#name vlan30
Switch(config-vlan)#exit
//配置端口2
Switch(config)#int f0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#no shutdown
Switch(config-if)#exit
//配置端口3
Switch(config)#int f0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 30
Switch(config-if)#no shutdown
Switch(config-if)#exit
//配置端口1
Switch(config)#int f0/1
Switch(config-if)#switchport mode trunk
配置结果