posts - 88, comments - 3, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

关于arp_ignore

Posted on 2012-11-27 17:16 Milo的海域 阅读(653) 评论(0)  编辑  收藏 所属分类: Linux
今天有同事反应一个网络现象,一个多网卡环境,发给eth1的数据包都被eth0接收了。
第一印象是arp的问题。Google了下得到了确认,有个相关的kernal参数:
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
4-7 - reserved
8 - do not reply for all local addresses
默认是0,解决这个问题需要配置为1

临时配置下
sysctl -w net.ipv4.conf.all.arp_ignore=1

持久配置
sysctl -w net.ipv4.conf.all.arp_ignore=1
echo 'net.ipv4.conf.all.arp_ignore
=1' >> /etc/sysctl.conf

这个弄好可以重启network服务来确保其他机器更新arp cache,如果不方便重启network,自己手动敲arping命令,比如
arping -q -A -c 1 -I eth1 10.197.24.177
这个命令是在 /etc/sysconfig/network-scripts/ifup-eth里看到的

如果机器比较少,也可以直接用arp -d 来删除相关的cache,建议上面的那种发广播的方式。

只有注册用户登录后才能发表评论。


网站导航: