拓扑结构图
实验步骤
第一步:配置R1路由器
<Huawei>sys
[Huawei]sysname R1
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10
//封装dot1q协议,该子接口对应vlan10
[R1-GigabitEthernet0/0/0.10]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/0.10]arp broadcast enable
//开启arp广播
[R1-GigabitEthernet0/0/0.10]interface g0/0/0.20
[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.20]ip address 192.168.20.1 24
[R1-GigabitEthernet0/0/0.20]arp broadcast enable
第二步:配置LSW1交换机
<Huawei>sys
[Huawei]sysname sw1
[SW1]vlan batch 10 20
//创建vlan10 20
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]port link-type access
//配置access链路
[SW1-Ethernet0/0/1]port default vlan 10
//接口划入vlan10
[SW1-Ethernet0/0/1]undo shutdown
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2undo shutdown
[SW1-Ethernet0/0/2]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
//配置trunk链路
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
//设置放行所有vlan
[SW1-GigabitEthernet0/0/1]undo sh
第三步:配置PC端IP地址及网关
第四步:测试网络互联互通