三层交换机集成了路由器和交换机的功能,融合了路由器和交换机各自的优势,在功能上实现了VLAN 的划分、VLAN 内部的二层交换和VLAN 间路由的功能。
<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname WU
[WU]vlan batch 41 42
[WU]interface GigabitEthernet0/0/1
[WU-GigabitEthernet0/0/1]port link-type access
[WU-GigabitEthernet0/0/1]port default vlan 41
[WU-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2
[WU-GigabitEthernet0/0/2]port link-type access
[WU-GigabitEthernet0/0/2]port default vlan 41
[WU-GigabitEthernet0/0/2]interface GigabitEthernet0/0/3
[WU-GigabitEthernet0/0/3]port link-type access
[WU-GigabitEthernet0/0/3]port default vlan 42
[WU-GigabitEthernet0/0/3]q
[WU]q
<WU>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]:
Sep 13 2022 01:05:27-08:00 WU %%01CFM/4/SAVE(l)[1]:The user chose Y when decidin
g whether to save the configuration to the device.
测试:
PC>ping 192.168.41.2
Ping 192.168.41.2: 32 data bytes, Press Ctrl_C to break
From 192.168.41.2: bytes=32 seq=1 ttl=128 time=32 ms
From 192.168.41.2: bytes=32 seq=2 ttl=128 time=32 ms
From 192.168.41.2: bytes=32 seq=3 ttl=128 time=46 ms
From 192.168.41.2: bytes=32 seq=4 ttl=128 time=31 ms
From 192.168.41.2: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.41.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/37/47 ms
PC>ping 192.168.42.1
Ping 192.168.42.1: 32 data bytes, Press Ctrl_C to break
From 192.168.41.1: Destination host unreachable
From 192.168.41.1: Destination host unreachable
From 192.168.41.1: Destination host unreachable
From 192.168.41.1: Destination host unreachable
From 192.168.41.1: Destination host unreachable
--- 192.168.41.254 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
PC>
三层配置:
[WU]interface Vlanif 41
[WU-Vlanif41]ip address 192.168.41.254 24
[WU-Vlanif41]q
[WU]interface Vlanif 42
[WU-Vlanif42]ip address 192.168.42.254 24
[WU-Vlanif42]q
[WU]q
<WU>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]:
Sep 13 2022 01:10:32-08:00 WU %%01CFM/4/SAVE(l)[6]:The user chose Y when decidin
g whether to save the configuration to the device.
Now saving the current configuration to the slot 0.
Save the configuration successfully.
[WU]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.41.0/24 Direct 0 0 D 192.168.41.254 Vlanif41
192.168.41.254/32 Direct 0 0 D 127.0.0.1 Vlanif41
192.168.42.0/24 Direct 0 0 D 192.168.42.254 Vlanif42
192.168.42.254/32 Direct 0 0 D 127.0.0.1 Vlanif42
[WU]
测试:
PC>ping 192.168.42.1
Ping 192.168.42.1: 32 data bytes, Press Ctrl_C to break
From 192.168.42.1: bytes=32 seq=1 ttl=127 time=93 ms
From 192.168.42.1: bytes=32 seq=2 ttl=127 time=32 ms
From 192.168.42.1: bytes=32 seq=3 ttl=127 time=15 ms
From 192.168.42.1: bytes=32 seq=4 ttl=127 time=47 ms
From 192.168.42.1: bytes=32 seq=5 ttl=127 time=31 ms
--- 192.168.42.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/43/93 ms
PC>