三层交换机实现VLAN 间路由

文章展示了如何使用华为交换机进行VLAN配置,创建VLAN41和42,并分配端口。配置完成后,VLAN41和42的IP地址可成功通信,实现了VLAN间的路由功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

三层交换机集成了路由器和交换机的功能,融合了路由器和交换机各自的优势,在功能上实现了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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值