1 先创建如图 的网络拓扑图
1.1 需要设备:
交换机:S5700(1个)、S3700(2个)、
终端:PC(8个)
1.2 按照接口连线:
所有接口已显示
2 配置 交换机
2.1 LSW6:
关闭配置提示:< Huawei > undo terminal monitor
命令行如下( LSW6 ):
The device is running!<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]vlan 30
[Huawei-vlan30]vlan 40
[Huawei-vlan40]quit
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#return[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip addr 192.14.10.1 24
[Huawei-Vlanif10]int vlanif 20
[Huawei-Vlanif20]ip addr 192.14.20.1 24
[Huawei-Vlanif20]int vlanif 30
[Huawei-Vlanif30]ip addr 192.14.30.1 24
[Huawei-Vlanif30]int vlanif 40
[Huawei-Vlanif40]ip addr 192.14.40.1 24
[Huawei-Vlanif40]q
[Huawei]q
<Huawei>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]Y
Info: Please input the file name ( *.cfg, *.zip )[vrpcfg.zip]:
Mar 8 2022 21:43:37-08:00 Huawei %%01CFM/4/SAVE(l)[12]:The user chose Y when de
ciding whether to save the configuration to the device.
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<Huawei>
导出设备配置并保存(重点:不保存,下次打开就会出现丢失配置的情况)
2.2 LSW4、LSW5:
两者命令行一样(注意接口变一下)
代码如下( LSW4 ):
The device is running!<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]vlan 30
[Huawei-vlan30]vlan 40
[Huawei-vlan40]quit
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port def vlan 10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port def vlan 10
[Huawei-Ethernet0/0/2]int e0/0/6
[Huawei-Ethernet0/0/6]port link-type access
[Huawei-Ethernet0/0/6]port def vlan 20
[Huawei-Ethernet0/0/6]int e0/0/7
[Huawei-Ethernet0/0/7]port link-type access
[Huawei-Ethernet0/0/7]port def vlan 20
[Huawei-Ethernet0/0/7]q
[Huawei]q
<Huawei>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip )[vrpcfg.zip]:
Mar 8 2022 22:13:40-08:00 Huawei %%01CFM/4/SAVE(l)[4]:The user chose Y when dec
iding whether to save the configuration to the device.
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<Huawei>
代码如下( LSW5 ):
The device is running!<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]vlan 30
[Huawei-vlan30]vlan 40
[Huawei-vlan40]quit
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port def vlan 30
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port def vlan 30
[Huawei-Ethernet0/0/2]int e0/0/6
[Huawei-Ethernet0/0/6]port link-type access
[Huawei-Ethernet0/0/6]port def vlan 40
[Huawei-Ethernet0/0/6]int e0/0/7
[Huawei-Ethernet0/0/7]port link-type access
[Huawei-Ethernet0/0/7]port def vlan 40
[Huawei-Ethernet0/0/7]q
[Huawei]q
<Huawei>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip )[vrpcfg.zip]:
Mar 8 2022 22:13:40-08:00 Huawei %%01CFM/4/SAVE(l)[4]:The user chose Y when dec
iding whether to save the configuration to the device.
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<Huawei>
3 配置 终端(PC)
【XX:可自己随意设置】
VLAN 10:
PC1(192.XX.10.2)
PC2(192.XX.10.3)
VLAN 20:
PC3(192.XX.20.2)
PC4(192.XX.20.3)
VLAN 30:
PC4(192.XX.30.2)
PC5(192.XX.30.3)
VLAN 40:
PC6(192.XX.40.2)
PC7(192.XX.40.3)
4 验证 (ping命令)
此处用 vlan 30 中的 PC6(192.XX.40.2)
分别 ping vlan 10 和 vlan 40
结果 ping 通 配置完成!
5 补充 (部分命令意义)
如果网关设置错了 先删除再配置
可用命令 undo ip addr
导出设备配置并保存(重点:不保存,下次打开就会出现丢失配置的情况)
小编就曾因为没有保存导出配置
而重新配置过好几次 引以为戒啊!!!
最后的最后 如有问题 欢迎各位指正!!!
本文转载自: https://blog.csdn.net/weixin_47725780/article/details/123363496
版权归原作者 源相 所有, 如有侵权,请联系我们删除。
版权归原作者 源相 所有, 如有侵权,请联系我们删除。