单臂路由,配置vlan后可以互相ping

文章详细描述了如何在华为交换机和路由器上配置VLAN,包括创建VLAN、分配端口类型、设置Trunk端口允许通过的VLAN以及在路由器上进行Dot1Q终结。配置完成后,通过ping测试验证了不同VLAN间的通信成功。
摘要由CSDN通过智能技术生成

单臂路由

要求:配置vlan后可以互相ping
image-20240419144653710

交换机配置

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]interface Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei-Ethernet0/0/2]q
[Huawei]interface Ethernet 0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 20
[Huawei-Ethernet0/0/3]quit
[Huawei]interface Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan 10 20
[Huawei-Ethernet0/0/1]display this
#
interface Ethernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
return
[Huawei-Ethernet0/0/1]quit
[Huawei]
<Huawei>save

路由器配置

<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]interface Ethernet 0/0/0.1
[Huawei-Ethernet0/0/0.1]dot1q termination vid 10
[Huawei-Ethernet0/0/0.1]ip address 192.168.10.254 255.255.255.0
[Huawei-Ethernet0/0/0.1]arp broadcast enable
[Huawei-Ethernet0/0/0.1]display this
#
interface Ethernet0/0/0.1
 dot1q termination vid 10
 ip address 192.168.10.254 255.255.255.0
 arp broadcast enable
#
return
[Huawei-Ethernet0/0/0.1]quit
[Huawei]interface Ethernet 0/0/0.2
[Huawei-Ethernet0/0/0.2]dot1q termination vid 20
[Huawei-Ethernet0/0/0.2]ip address 192.168.20.254 255.255.255.0
[Huawei-Ethernet0/0/0.2]arp broadcast enable
[Huawei-Ethernet0/0/0.2]quit
[Huawei]display ip interface brief
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 9
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 10

Interface                         IP Address/Mask      Physical   Protocol  
Ethernet0/0/0                     unassigned           up         down      
Ethernet0/0/0.1                   192.168.10.254/24    up         up        
Ethernet0/0/0.2                   192.168.20.254/24    up         up        
Ethernet0/0/1                     unassigned           down       down      
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
GigabitEthernet0/0/3              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial0/0/0                       unassigned           down       down      
Serial0/0/1                       unassigned           down       down      
Serial0/0/2                       unassigned           down       down      
Serial0/0/3                       unassigned           down       down      
[Huawei]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.10.0/24  Direct  0    0           D   192.168.10.254  Ethernet0/0/0.1
 192.168.10.254/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0.1
   192.168.20.0/24  Direct  0    0           D   192.168.20.254  Ethernet0/0/0.2
 192.168.20.254/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0.2

测试

PC>ping 192.168.20.20

Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break
From 192.168.20.20: bytes=32 seq=1 ttl=127 time=78 ms
From 192.168.20.20: bytes=32 seq=2 ttl=127 time=63 ms
From 192.168.20.20: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.20.20: bytes=32 seq=4 ttl=127 time=63 ms
From 192.168.20.20: bytes=32 seq=5 ttl=127 time=109 ms

--- 192.168.20.20 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 63/78/109 ms
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值