eNSP 不同的VLAN之间的通信 单臂路由 学习笔记 2023-8-29

单臂路由方式,实现,不同VLAN的主机的通信,主机A,可访问主机B

配置 R1

<Huawei>system-view 
[Huawei]sysname R1
[R1]
[R1]
[R1]int e0/0/0.1
[R1-Ethernet0/0/0.1]dot1q termination vid 10
[R1-Ethernet0/0/0.1]ip address 192.168.1.254 24
[R1-Ethernet0/0/0.1]arp broadcast enable
[R1-Ethernet0/0/0.1]dis this
#
interface Ethernet0/0/0.1
 dot1q termination vid 10
 ip address 192.168.1.254 255.255.255.0
 arp broadcast enable
#
return
[R1-Ethernet0/0/0.1]quit
[R1]
[R1]
[R1]int e0/0/0.2
[R1-Ethernet0/0/0.2]dot1q termination vid 20
[R1-Ethernet0/0/0.2]ip address 192.168.2.254 24
[R1-Ethernet0/0/0.2]arp broadcast enable
[R1-Ethernet0/0/0.2]
[R1-Ethernet0/0/0.2]dis this
#
interface Ethernet0/0/0.2
 dot1q termination vid 20
 ip address 192.168.2.254 255.255.255.0
 arp broadcast enable
#
return
[R1-Ethernet0/0/0.2]quit
[R1]
[R1]
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 7        

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.1.0/24  Direct  0    0           D   192.168.1.254   Ethernet0/0/0.1
  192.168.1.100/32  Direct  0    0           D   192.168.1.100   Ethernet0/0/0.1
  192.168.1.254/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0.1
    192.168.2.0/24  Direct  0    0           D   192.168.2.254   Ethernet0/0/0.2
  192.168.2.254/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0.2

[R1]

配置 SW1

<Huawei>system-view 
[Huawei]sysname SW1
[SW1]vlan batch 10 20
[SW1]
[SW1]int e0/0/2	
[SW1-Ethernet0/0/2]port link-type access 
[SW1-Ethernet0/0/2]port default vlan 10
[SW1-Ethernet0/0/2]
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]port link-type access 
[SW1-Ethernet0/0/3]port default vlan 20
[SW1-Ethernet0/0/3]
[SW1-Ethernet0/0/3]int e0/0/1
[SW1-Ethernet0/0/1]port link-type trunk	
[SW1-Ethernet0/0/1]port trunk allow-pass vlan 10 20
[SW1-Ethernet0/0/1]
[SW1-Ethernet0/0/1]quit
[SW1]

配置 PC-A

配置 PC-B

测试

从PCA 和 PCB,能互相ping通。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注