Step1:输入必打命令
<Huawei>undo terminal monitor(关闭自动弹窗)
<Huawei>system-view (进入系统视图)
[Huawei]sysname SW5(命名交换机为SW5)
[SW5]user-interface console 0
[SW5-ui-console0]idle-timeout 0 0(设置永不超时)
[SW5-ui-console0]quit
R1同上
Step2:配置交换机
[SW5]vlan batch 10 20(创建虚拟局域网10和20)
[SW5]int e0/0/1(进入接口e0/0/1)
[SW5-Ethernet0/0/1]port hybrid pvid vlan 10 (打上vlan10的标签)
[SW5-Ethernet0/0/1]port hybrid untagged vlan 10(剔除vlan10的标签)
[SW5-Ethernet0/0/1]int e0/0/2(进入e0/0/2接口)
[SW5-Ethernet0/0/2]port hybrid pvid vlan 20 (打上vlan20的标签)
[SW5-Ethernet0/0/2]port hybrid untagged vlan 20(剔除vlan20的标签)
[SW5-Ethernet0/0/2]int g0/0/1(进入g0/0/01接口)
[SW5-GigabitEthernet0/0/1]port link-type trunk (把接口模式设置为trunk)
[SW5-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20(允许vlan10 vlan20通过)
Step3:配置路由器
[R1]int g0/0/0(进入接口g0/0/0)
[R1-GigabitEthernet0/0/0]undo shutdown(启动)
[R1-GigabitEthernet0/0/0]int g0/0/0.1(进入虚拟接口g0/0/0.1)
[R1-GigabitEthernet0/0/0.1]vlan-type dot1q 10 default(设置vlan10协议为802.1q)
[R1-GigabitEthernet0/0/0.1]ip add 192.168.1.1 24(设置网关为192.168.1.1)
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2(进入虚拟接口g0/0/0.2)
[R1-GigabitEthernet0/0/0.2]vlan-type dot1q 20 default (设置vlan20协议为802.1q)
[R1-GigabitEthernet0/0/0.2]ip add 192.168.2.1 24(设置网关为192.168.2.1)
Step4:观察实验现象
不同vlan的情况下的两台PC机是不可互通的,通过此实验实现了互通