**實驗環境
房間之間不能通信,但每個房間都可以與出口路由器通信
SW1——配置各個接口
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname SW1 //改名
[SW1]vlan batch 10 20 30 //創建VLAN10、VLAN20和VLAN30
[SW1]interface g0/0/1 //進入接口
[SW1-GigabitEthernet0/0/1]port hybrid pvid vlan 30 //設置爲本徵VLAN,不打標記
[SW1-GigabitEthernet0/0/1]port hybrid untagged vlan 10 20 30 //設置當前接口爲hybrid模式,去掉VLAN10、VLAN20和VLAN30的標記
[SW1-GigabitEthernet0/0/1]quit //退出
[SW1]interface g0/0/2 //進入接口
[SW1-GigabitEthernet0/0/2]port hybrid pvid vlan 10 //設置爲本徵VLAN,不打標記
[SW1-GigabitEthernet0/0/2]port hybrid untagged vlan 10 30 //設置當前接口爲hybrid模式,去掉VLAN10和VLAN30的標記
[SW1-GigabitEthernet0/0/2]quit //退出
[SW1]interface g0/0/3 //進入接口
[SW1-GigabitEthernet0/0/3]port hybrid pvid vlan 20 //設置爲本徵VLAN,不打標記
[SW1-GigabitEthernet0/0/3]port hybrid untagged vlan 20 30 //設置當前接口爲hybrid模式,去掉VLAN20和VLAN30的標記
[SW1-GigabitEthernet0/0/3]quit //退出
[SW1]
PC1——測試是否可以ping通出口路由器,不能ping通PC2
PC>ping 192.168.1.1 //測試ping出口路由器
Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=128 time=31 ms
From 192.168.1.1: bytes=32 seq=2 ttl=128 time=32 ms
From 192.168.1.1: bytes=32 seq=3 ttl=128 time=31 ms
From 192.168.1.1: bytes=32 seq=4 ttl=128 time=32 ms
From 192.168.1.1: bytes=32 seq=5 ttl=128 time=31 ms //ping通
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/31/32 ms
PC>ping 192.168.1.20 //測試是否可以ping通PC2
Ping 192.168.1.20: 32 data bytes, Press Ctrl_C to break
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable //ping不通
--- 192.168.1.20 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>
PC2——測試是否可以ping通出口路由器,不能ping通PC1
PC>ping 192.168.1.1 //測試是否可以ping通出口路由器
Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=128 time=32 ms
From 192.168.1.1: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.1.1: bytes=32 seq=3 ttl=128 time=31 ms
From 192.168.1.1: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.1.1: bytes=32 seq=5 ttl=128 time=31 ms //ping通
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/34/47 ms
PC>ping 192.168.1.10 //測試是否可以ping通PC1
Ping 192.168.1.10: 32 data bytes, Press Ctrl_C to break
From 192.168.1.20: Destination host unreachable
From 192.168.1.20: Destination host unreachable
From 192.168.1.20: Destination host unreachable
From 192.168.1.20: Destination host unreachable
From 192.168.1.20: Destination host unreachable //不能ping通
--- 192.168.1.10 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>