华为 eNSP—交换机配置(三层)
Posted 源相
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了华为 eNSP—交换机配置(三层)相关的知识,希望对你有一定的参考价值。
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
导出设备配置并保存(重点:不保存,下次打开就会出现丢失配置的情况)
小编就曾因为没有保存导出配置
而重新配置过好几次 引以为戒啊!!!
最后的最后 如有问题 欢迎各位指正!!!
华为三层交换机基础配置
华为三层交换机
工作原理:一次交换,多次转发
作用:实现vlan间的数据互通
ensp拓扑图如下:
SW2
<Huawei>sys
[Huawei]sysname SW2
[SW2]vlan batch 10 20
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 10
[SW2-Ethernet0/0/2]un sh
[SW2-Ethernet0/0/2]int e0/0/3
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default vlan 20
[SW2-Ethernet0/0/3]un sh
[SW2-Ethernet0/0/3]int e0/0/1
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]port trunk allow-pass vlan all
[SW2-Ethernet0/0/1]un sh
[SW2-Ethernet0/0/1]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/1]un sh
SW3
<Huawei>sys
[Huawei]sysname SW3
[SW3]vlan batch 10 20
[SW3]int e0/0/2
[SW3-Ethernet0/0/2]port link-type access
[SW3-Ethernet0/0/2]port default vlan 10
[SW3-Ethernet0/0/2]un sh
[SW3-Ethernet0/0/2]int e0/0/3
[SW3-Ethernet0/0/3]port link-type access
[SW3-Ethernet0/0/3]port default vlan 20
[SW3-Ethernet0/0/3]un sh
[SW3-Ethernet0/0/3]int e0/0/1
[SW3-Ethernet0/0/1]port link-type trunk
[SW3-Ethernet0/0/1]port trunk allow-pass vlan all
[SW3-Ethernet0/0/1]un sh
SW1
<Huawei>sys
[Huawei]sysname SW1
[SW1]vlan batch 10 20 1000
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/1]un sh
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 1000
[SW1-GigabitEthernet0/0/2]un sh
[SW1-GigabitEthernet0/0/2]q
[SW1]int vlanif 10
[SW1-Vlanif10]ip add 192.168.10.1 24
[SW1-Vlanif10]int vlanif 20
[SW1-Vlanif20]ip add 192.168.20.1 24
[SW1]int vlanif 1000
[SW1-Vlanif1000]ip add 11.0.0.1 30
[SW1-Vlanif1000]q
[SW1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.2
R1
<Huawei>sys
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 11.0.0.2 30
[R1-GigabitEthernet0/0/0]un sh
[R1-GigabitEthernet0/0/0]int loopback 0
[R1-LoopBack0]ip add 1.1.1.1 30
[R1-LoopBack0]q
[R1]ip route-static 192.168.10.0 24 11.0.0.1
[R1]ip route-static 192.168.20.0 24 11.0.0.1
配置完成后可实现各个主机之间互联互通
谢谢!!
以上是关于华为 eNSP—交换机配置(三层)的主要内容,如果未能解决你的问题,请参考以下文章
计算机网络实验(华为eNSP模拟器)——第三章 配置IP地址和网关