重叠 VLAN/路由器 ARP 回复

网络工程 转变 arp
2021-07-21 06:14:02

在此处输入图片说明

您好,{unnamed company} 已经建立了一些 VLSM 网络,但它们重叠。

所以网络 1 是10.15.0.0/16,网络 2 是10.15.208.0/24

现在你可以看到这些是如何重叠的:

10.15.0.1 - 254.255

10.15.208.1 - 254

...它们都包含10.15.208.2. 这是网络 2 上 DC 的 IP。

网络 1 中的机器可以连接到 DC。

我的问题是……如何?

我通过数据包跟踪器的模拟运行它,我可以看到网络 1 上的主机发送一个 ARP,路由器 0 用自己的 mac 地址回复该 ARP。这是为什么?是不是因为路由器 0 有 10.15.208.0/24 的静态路由?

这种奇怪的设置还有什么含义?

路由器 0:

 Gateway of last resort is not set
         10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    C       10.15.0.0/16 is directly connected, FastEthernet0/0
    S       10.15.208.0/24 [1/0] via 192.168.0.2
    C    192.168.0.0/16 is directly connected, FastEthernet0/1


Building configuration...

Current configuration : 557 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
 ip address 10.15.0.1 255.255.0.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.0.1 255.255.0.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
ip route 10.15.208.0 255.255.255.0 192.168.0.2 
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

路由器 1:

Gateway of last resort is not set
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S       10.15.0.0/16 [1/0] via 192.168.0.1
C       10.15.208.0/24 is directly connected, FastEthernet0/0
C    192.168.0.0/16 is directly connected, FastEthernet0/1

Building configuration...

Current configuration : 557 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
 ip address 10.15.208.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.0.2 255.255.0.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
ip route 10.15.0.0 255.255.0.0 192.168.0.1 
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end
4个回答

路由器正在使用代理 ARP。这是默认启用的功能。由于路由器知道如何到达目标地址,它将代表主机使用自己的 MAC 地址进行响应,并且来自源的所有帧都将发送到路由器,然后路由器可以路由到目的地。

思科代理 ARP

假设 router0 和 router1 知道所有网络,这是正常行为。

路由器 (Cisco) 使用以下算法来确定将数据包转发到何处

  1. 如果没有路由与目标地址匹配,则丢弃数据包。
  2. 如果只有一条路由与地址匹配,则将数据包从定义的接口转发出去。
  3. 如果存在多个路由,则使用子网掩码最长的路由(最具体的路由)。
  4. 如果有多条路由具有最具体的路由,则选择管理距离最小的路由。
  5. 如果不止一条路由具有相同的管理距离,则选择具有最低度量的路由。
  6. 如果多个路由具有最低度量,则在所有路由之间交替(每个数据包或每个流,取决于配置)。

您的路由器正在参与代理 ARP当有人代表另一个实体回答 ARP 请求时,就会发生代理 ARP

在您的示例中,路由器代表 10.15.208.0/24 网络中的主机提供 ARP 响应。路由器这样做是因为它知道如何通过静态路由 ( ip route 10.15.208.0 255.255.255.0 192.168.0.2)到达 /24 网络

以下是代理 ARP 工作原理的说明:

代理 ARP - 实用网络 .net

我会说这就是路由器做出转发决策的方式。如果两个网络都通过相同的路由协议进行通告,则管理距离将相同。但是较小的网络 /24 将是首选,因此即使路由器知道如何为网络 10.15.208.0/24 中的任何 IP 到达 10.15.0.0/16 也会将其发送到数据中心,因为它更受欢迎。

这意味着网络重叠,这可能会导致在线某处出现严重问题。