华为单臂路由VLAN划分
来源:原创
时间:2024-01-18
作者:脚本小站
分类:网络
网络图:
设置命令:
LSW1:
# 创建vlan <Huawei>system-view [Huawei]undo info-center enable # 关闭消息提示 [Huawei]vlan batch 10 20 # 划分两个vlan,vlan 10 和 vlan 20 [Huawei]display vlan # 将端口划分为某个vlan [Huawei] [Huawei]int e0/0/1 # 进入到e1口 [Huawei-Ethernet0/0/1]port link-type access # 设置连接模式 [Huawei-Ethernet0/0/1]port default vlan 10 # 将该口划分到vlan 10 [Huawei-Ethernet0/0/1]int e0/0/2 # 进入到端口2 [Huawei-Ethernet0/0/2]port link-type access # 设置连接模式 [Huawei-Ethernet0/0/2]port default vlan 20 # 将该口划分到vlan 20 设置G口: [Huawei-Ethernet0/0/2]int g0/0/1 [Huawei-GigabitEthernet0/0/1]port link-type trunk # 设备与设备之间连接用trunk [Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all # 允许所有vlan通过 # 保存配置 <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]: Now saving the current configuration to the slot 0. Save the configuration successfully. <Huawei>
R1:
<Huawei>system-view Enter system view, return user view with Ctrl+Z. Info: Information center is disabled. [Huawei]undo info-center enable # 关闭消息提示 创建并设置虚拟子接口: # 绑定G1口的第一个vlan [Huawei]int g0/0/1.10 # 进入g1口的10vlan,这种情况下要用 0/0/1.xx xx代表vlan号 [Huawei-GigabitEthernet0/0/1.10]ip address 192.168.1.254 24 #设置IP [Huawei-GigabitEthernet0/0/1.10]dot1q termination vid 10 # 绑定vlan10 [Huawei-GigabitEthernet0/0/1.10]arp broadcast enable # 开启arp广播 # 绑定G1的第二个vlan [Huawei-GigabitEthernet0/0/1.10]int g0/0/1.20 # 设置G1口的第二个vlan [Huawei-GigabitEthernet0/0/1.20]ip address 192.168.2.254 24 # 设置IP,也就是网关 [Huawei-GigabitEthernet0/0/1.20]dot1q termination vid 20 # 绑定vlan20 [Huawei-GigabitEthernet0/0/1.20]arp broadcast enable # 开启arp广播 # 保存配置 效果通save命令 <Huawei>reset saved-configuration This will delete the configuration in the flash memory. The device configuratio ns will be erased to reconfigure. Are you sure? (y/n)[n]:y Clear the configuration in the device successfully. <Huawei>
快速查询排错:
[Huawei]display ip interface brief