實驗環境:
配置super-vlan使不同VLAN的IP在同一網段,且擁有同一個網關
SW1——將對應的PC劃分到相應的VLAN中
<Huawei>system-view //進入全局配置模式
[Huawei]undo info-center enable //關閉信息告警提示
[Huawei]sysname SW1 //改名
[SW1]vlan batch 10 20 30 //創建VLAN10 VLAN20 VLAN30
[SW1]port-group group-member g 0/0/1 to g 0/0/2 //對多個接口進行配置
[SW1-port-group]port link-type access //將接口設置爲access鏈路
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-port-group]port default vlan 10 //將端口劃分爲VLAN10
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/2]port default vlan 10
[SW1-port-group]quit //退出
[SW1]port-group group-member g0/0/3 to g0/0/4 //對多個接口進行配置
[SW1-port-group]port link-type access //將接口設置爲access鏈路
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/4]port link-type access
[SW1-port-group]port default vlan 20 //將端口劃分爲VLAN20
[SW1-GigabitEthernet0/0/3]port default vlan 20
[SW1-GigabitEthernet0/0/4]port default vlan 20
[SW1-port-group]quit //退出
SW1——將VLAN30設備爲聚合鏈路,並將VLAN10和VLAN20定義爲VLAN30的子VLAN
[SW1]vlan 30
[SW1-vlan30]aggregate-vlan //將VLAN 30 定義爲聚合VLAN
[SW1-vlan30]access-vlan 10 20 //將VLAN 10和VLAN 20定義爲VLAN 30的子VLAN
[SW1-vlan30]quit //退出
SW1——查看VLAN信息
[SW1]dis vlan //查看VLNA信息
The total number of vlans is : 4
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D)
GE0/0/9(D) GE0/0/10(D) GE0/0/11(D) GE0/0/12(D)
GE0/0/13(D) GE0/0/14(D) GE0/0/15(D) GE0/0/16(D)
GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D)
GE0/0/21(D) GE0/0/22(D) GE0/0/23(D) GE0/0/24(D)
10 sub UT:GE0/0/1(U) GE0/0/2(U)
20 sub UT:GE0/0/3(U) GE0/0/4(U)
30 super
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
30 enable default enable disable VLAN 0030
SW1——設置VLAN10和VLAN20的網關
[SW1]interface vlan30 //進入VLAN30
[SW1-Vlanif30]ip address 192.168.1.1 24 //該地址將作爲VLAN 10和VLAN 20的網關
[SW1-Vlanif30]quit //退出
[SW1]
PC1——測試同一VLAN是否可以ping通
PC>ping 192.168.1.3 //同一VLAN
Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to break
From 192.168.1.3: bytes=32 seq=1 ttl=128 time=32 ms
From 192.168.1.3: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.1.3: bytes=32 seq=3 ttl=128 time=31 ms
From 192.168.1.3: bytes=32 seq=4 ttl=128 time=31 ms
From 192.168.1.3: bytes=32 seq=5 ttl=128 time=31 ms //可以ping通
--- 192.168.1.3 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.4 //不同VLAN
Ping 192.168.1.4: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable //不能ping通
--- 192.168.1.4 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>ping 192.168.1.5 //不同VLAN
Ping 192.168.1.5: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable
From 192.168.1.2: Destination host unreachable //不能ping通
--- 192.168.1.5 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>
PC3——測試同一VLAN是否可以ping通
PC>ping 192.168.1.5 //同一VLAN
Ping 192.168.1.5: 32 data bytes, Press Ctrl_C to break
From 192.168.1.5: bytes=32 seq=1 ttl=128 time=31 ms
From 192.168.1.5: bytes=32 seq=2 ttl=128 time=46 ms
From 192.168.1.5: bytes=32 seq=3 ttl=128 time=15 ms
From 192.168.1.5: bytes=32 seq=4 ttl=128 time=15 ms
From 192.168.1.5: bytes=32 seq=5 ttl=128 time=15 ms
--- 192.168.1.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/24/46 ms
PC>ping 192.168.1.2 //不同VLAN
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable //不能ping通
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>ping 192.168.1.3 //不同VLAN
Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to break
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable
From 192.168.1.4: Destination host unreachable //不能ping通
--- 192.168.1.3 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>
測試
SW1——創建一個迴環接口,測試PC是否可以ping通
[SW1]interface LoopBack 0 //創建迴環接口
[SW1-LoopBack0]ip address 9.9.9.9 24 //設置IP地址
[SW1-LoopBack0]quit //退出
[SW1]
PC1——測試是否可以ping通迴環接口
PC>ping 9.9.9.9 //ping 環回接口
Ping 9.9.9.9: 32 data bytes, Press Ctrl_C to break
From 9.9.9.9: bytes=32 seq=1 ttl=255 time=15 ms
From 9.9.9.9: bytes=32 seq=2 ttl=255 time=15 ms
From 9.9.9.9: bytes=32 seq=3 ttl=255 time<1 ms
From 9.9.9.9: bytes=32 seq=4 ttl=255 time<1 ms
From 9.9.9.9: bytes=32 seq=5 ttl=255 time=16 ms //ping 通
--- 9.9.9.9 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 0/9/16 ms
PC>
PC3——測試是否可以ping通迴環接口
PC>ping 9.9.9.9 //ping 環回接口
Ping 9.9.9.9: 32 data bytes, Press Ctrl_C to break
From 9.9.9.9: bytes=32 seq=1 ttl=255 time=15 ms
From 9.9.9.9: bytes=32 seq=2 ttl=255 time=15 ms
From 9.9.9.9: bytes=32 seq=3 ttl=255 time=15 ms
From 9.9.9.9: bytes=32 seq=4 ttl=255 time=15 ms
From 9.9.9.9: bytes=32 seq=5 ttl=255 time<1 ms //ping 通
--- 9.9.9.9 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 0/12/15 ms
PC>