加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

ARP响应Linux服务器上的单个MAC地址,同一网络上有多个接口

发布时间:2020-12-14 03:02:22 所属栏目:Linux 来源:网络整理
导读:Linux服务器有2个活动网络接口: IF:eth1 IP:192.168.1.1/24 MAC:11:11:11:11:11:11 (1GbE)IF:eth2 IP:192.168.1.2/24 MAC:22:22:22:22:22:22 (10GbE) 我们的想法是10GbE接口(eth2)是与网络上主机通信的主要接口.我想将第二个1GbE接口(eth1)保留为故障保护.
Linux服务器有2个活动网络接口:
IF:eth1    IP:192.168.1.1/24    MAC:11:11:11:11:11:11   (1GbE)
IF:eth2    IP:192.168.1.2/24    MAC:22:22:22:22:22:22   (10GbE)

我们的想法是10GbE接口(eth2)是与网络上主机通信的主要接口.我想将第二个1GbE接口(eth1)保留为故障保护.如果10GbE接口出现故障:我还有一个简单的方法,可以更新DNS,以便主机可以连接等.

在观察接口统计信息时,我注意到所有流量都在eth1而不是eth2上发送/接收,尽管网络上的所有主机都在寻址此接口.我确认DNS A记录指向正确接口的IP.此外,我确认通过IP而不是FQDN寻址接口会产生相同的结果.

我清除了机器上的ARP缓存,并通过IP地址ping了eth1接口.我检查我的ARP表并找到eth1的MAC地址.我再次清除了ARP缓存,并通过IP地址ping了eth2接口.再次,我检查我的ARP表并找到eth1的MAC地址(不是eth2).

如果我关闭eth1,物理断开接口,或将其放在不同的逻辑网络上 – 我得到预期的行为,流量超过我的eth2接口.

我的问题:为什么会这样?我看到一些证据表明这是Linux内核的预期行为,因为它的“弱主机模型”.

如何在同一网络上保持两个接口,并让它们以我期望的方式工作.

解决方法

Linux旨在响应任何接口上的ARP请求.假设主机拥有IP地址而不是特定接口.你所看到的叫做ARP Flux.

您可以使用sysctrl更改此行为

arp_ignore – INTEGER

Define different modes for sending replies in response to
received ARP requests that resolve local target IP addresses:

0 – (default): reply for any local target IP address,configured
on any interface

1 – reply only if the target IP address is local address
configured on the incoming interface

2 – reply only if the target IP address is local address
configured on the incoming interface and both with the
sender’s IP address are part from same subnet on this interface

3 – do not reply for local addresses configured with scope host,only resolutions for global and link addresses are replied

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读