1.配置主机ip、子网掩码及网关
PC1:192.168.1.2 255.255.255.0 192.168.1.1
PC2:192.168.2.2 255.255.255.0 192.168.2.1
PC3:192.168.1.3 255.255.255.0 192.168.1.1
PC4:192.168.2.3 255.255.255.0 192.168.2.1
2.设置交换机接主机VLAN(左右交换机同样配置)
system //进入配置
int eth0/0/1 //进入连接PC1端口
port link-type access //设置端口类型为access
port default vlan 2 //将接口添加到VLAN 2中
quit //退出接口
int eth0/0/2 //进入连接PC1端口
port link-type access //设置端口类型为access
port default vlan 3 //将接口添加到VLAN 2中
quit //退出接口
int eth0/0/3 //进入交换机互联端口
port link-type trunk //设置端口类型为trunk
port trunk allow-pass vlan all //配置为VLAN全通模式
quit //退出配置模式
save //保存配置
y+回车 //保存
3.设置交换机连接三层交换机eth0/0/4接口(左右接口同样配置)
int eth0/0/4 //进入交换机连接路由器端口
port link-type trunk //设置端口类型为trunk
port trunk allow-pass vlan all //配置为VLAN全通模式
quit //退出接口
quit //退出配置模式
save //保存配置
y+回车 //保存
4.设置三层交换机
system //进入配置
vlan batch 2 3 //创建VLAN 2 3
int eth0/0/1 //进入接口
port link-type trunk //设置端口类型为trunk
port trunk allow-pass vlan all //配置为VLAN全通模式
quit //退出接口
int eth0/0/2 //进入接口
port link-type trunk //设置端口类型为trunk
port trunk allow-pass vlan all //配置为VLAN全通模式
quit //退出接口
int vlan 2 //进入vlan2进行配置
ip address 192.168.1.1 255.255.255.0 //设置vlan2IP地址和子网掩码
quit //退出接口
int vlan 3 //进入vlan3进行配置
ip address 192.168.2.1 255.255.255.0 //设置vlan3IP地址和子网掩码
quit //退出接口
quit //退出配置
save //保存
5.测试PC2(VLAN3 192.168.2.2)ping PC3(VLAN2 192.168.1.3)
https://www.lanzous.com/i3l8pxa