本次使用ensp模拟器模拟两台华为三层交换机如何配置不同网段不同vlan之间如何互通。网络拓补图如下图所示:
配置方法感觉非常奇怪,但是居然通信了。
IP地址如下:
pc1:10.1.1.2 / 24 pc2 :10.1.2.2 / 24 pc3:192.168.1.2 /24 pc4:192.168.2.2 / 24
LSW1配置如下:
<Huawei>system-view \\进入系统视图
[Huawei]undo info-center enable \\关闭日志
[Huawei]vlan batch 5 to 8 \\创建vlan5.6.7.8
[Huawei]interface vlan 5 \\进入vlan虚拟接口视图
[Huawei-Vlanif5]ip address 10.1.1.254 24 \\配置接口ip
[Huawei-Vlanif5]interface vlan 6
[Huawei-Vlanif6]ip address 10.1.2.254 24
[Huawei-Vlanif6]interface vlan 7
[Huawei-Vlanif7]ip address 192.168.1.254 24
[Huawei-Vlanif7]interface vlan 8
[Huawei-Vlanif8]ip address 192.168.2.254 24
[Huawei-Vlanif8]quit \\退出到系统视图
[Huawei]interface GigabitEthernet 0/0/1 \\进入0/0/1端口
[Huawei-GigabitEthernet0/0/1]port link-type access \\配置端口模式为access
[Huawei-GigabitEthernet0/0/1]port default vlan 5 \\将该端口划分至vlan 5中
[Huawei-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 6
[Huawei-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk \\配置端口模式为trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all \\允许所有vlan通过该trunk端口
[Huawei-GigabitEthernet0/0/3]return
<Huawei>save
LSW2配置如下:
<Huawei>system-view \\进入系统视图
[Huawei]undo info-center enable \\关闭日志
[Huawei]vlan batch 5 to 8 \\创建vlan5.6.7.8
[Huawei]interface vlan 5 \\进入vlan虚拟接口视图
[Huawei-Vlanif5]ip address 10.1.1.254 24 \\配置接口ip
[Huawei-Vlanif5]interface vlan 6
[Huawei-Vlanif6]ip address 10.1.2.254 24
[Huawei-Vlanif6]interface vlan 7
[Huawei-Vlanif7]ip address 192.168.1.254 24
[Huawei-Vlanif7]interface vlan 8
[Huawei-Vlanif8]ip address 192.168.2.254 24
[Huawei-Vlanif8]quit \\退出到系统视图
[Huawei]interface GigabitEthernet 0/0/1 \\进入0/0/1端口
[Huawei-GigabitEthernet0/0/1]port link-type access \\配置端口模式为access
[Huawei-GigabitEthernet0/0/1]port default vlan 7 \\将该端口划分至vlan 5中
[Huawei-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 8
[Huawei-GigabitEthernet0/0/2]interface GigabitEthernet 0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk \\配置端口模式为trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all \\允许所有vlan通过该trunk端口
[Huawei-GigabitEthernet0/0/3]return
<Huawei>save
最终结果使用四台pc互ping,显示互相ping通
还有一种方法为:不配置trunk链路,将LSW1交换机当作hub使用,不设置vlan,只在LSW2中划分vlan,将端口3加入,配置vlan多网关,使4台pc相互通信
有不对的地方,希望各位大佬指点经验。