No Gratuitous ARP Message on Reboot or IP Change?

No Gratuitous ARP Message on Reboot or IP Change?

重新启动或更改 IP 时没有免费的 ARP 消息?

https://forum.archive.openwrt.org/viewtopic.php?id=69878

 

I did notice that OpenWRT 15.05.1 does not send a Gratuitous ARP Message out when its IP address gets changed nor on a reboot, nor on a change of the Ethernet link state.

I have a device on my network which has an ARP cache table timeout of 20 minutes and it does not recognize that an IP address moves from one device to another within the 20 minutes what is way too long for my application.

When I start the command "arping -A -I br-lan 192.168.100.253 -c 1" the Gratuitous ARP Message gets send out and all devices on the network are aware that the IP address is now available on another MAC address as before.

Is that a failure on the OpenWRT system that it does not send out the Gratuitous ARP Message automatically, or is that an option which I can enable somehow?

(Last edited by michaeluray on 16 Feb 2017, 18:39)

我确实注意到 OpenWRT 15.05.1在其 IP 地址更改、重新启动或以太网链路状态更改时都不会发送免费 ARP消息。

我的网络上有一个设备,它的 ARP 缓存表超时为 20 分钟,它无法识别 IP 地址在 20 分钟内从一个设备移动到另一个设备,这对我的应用程序来说太长了。

当我启动命令“arping -A -I br-lan 192.168.100.253 -c 1”时,免费 ARP 消息被发送出去,网络上的所有设备都知道 IP 地址现在可以像以前一样在另一个 MAC 地址上使用。

这是 OpenWRT 系统上的故障,它没有自动发送免费 ARP 消息,还是我可以以某种方式启用的选项?

(最后由michaeluray于 2017 年 2 月 16 日 18:39 编辑)

 

Not sure if it's the way OpenWRT/linux works by default or an option to enable, but you could create a script to do just send an ARP every minute pretty easily.  Something like:

不确定这是 OpenWRT/linux 默认的工作方式还是启用的选项,但您可以创建一个脚本来非常轻松地每分钟发送一个 ARP。就像是:

mkdir -p /usr/share/arpping
vi /usr/share/gratarp/gratarp.sh

#!/bin/sh

while :
do

#which interface to gratuitous ARP
interface=br-lan

#seconds between pings
interval=60

#gets the current IP address for the interface you specified above
ipaddr=$(ip addr show $interface | grep "inet " | awk '{print $2}' | awk -F'/' '{print $1}')

arping -A -I $interface $ipaddr -c 1

sleep $interval

done

Then:

chmod 700 /usr/share/gratarp/gratarp.sh

vi /etc/rc.local

Add this to the file:

/usr/share/gratarp/gratarp.sh &

Just an idea.

CB

sloppyTypist wrote:

...but you could create a script to do just send an ARP every minute pretty easily.

...但是您可以创建一个脚本来非常轻松地每分钟发送一个 ARP。

Thanks for the idea with the script sloppyTypist.
It would be probably a good idea to add something like this (I have multiple IP addresses on the interfaces) to "/etc/hotplug.d/iface/" to send it every time out when a interface comes up, if there is not build-in (what I would prefere) solution avalable.

I found in the meanwhile out, that there is an option called arp_notify in "/etc/sysctl.conf", but it does not work for some reaseon.

"cat /proc/sys/net/ipv4/conf/br-lan/arp_notify" returns 1 now, so I guess it should be enabled, but it does not send  the Gratuitous ARP packet on network restart nor on a reboot.

Any ideas why it does not work?

感谢脚本 sloppyTypist 的想法。
将这样的内容(我在接口上有多个 IP 地址)添加到“/etc/hotplug.d/iface/”以在每次接口出现时发送它可能是一个好主意,如果没有内置(我更喜欢的)解决方案可用。

与此同时,我发现“/etc/sysctl.conf”中有一个名为arp_notify的选项,但由于某些原因它不起作用。

"cat /proc/sys/net/ipv4/conf/br-lan/arp_notify" 现在返回 1,所以我猜它应该启用,但它不会在网络重启或重启时发送免费 ARP 数据包。

任何想法为什么它不起作用?

 

That's handy to know about that I can tell linux to GARP.

Not sure why that's not working, I'm not a dev, just a lowly network engineer.  It could be for a different kernel version where the option isnt fully implemented in the one you are running, even though the option is set.  It's also possible that you need to install a kernel module.  I would submit that as a bug to OpenWRT.

Yeah, you might put it in hotplug.  The only thing is getting the the right interface that came up to GARP on.  Maybe grep/awk from readlog the most recent interface up pull that for the interface variable.  You could also just create two scripts.  Or even slicker you could also turn the garp ping into a function, run it twice with different arguments for the different interfaces.

Let us know how it ends up for you.

(Last edited by sloppyTypist on 19 Feb 2017, 00:10)

这很方便知道我可以告诉 linux 到 GARP。

不知道为什么这不起作用,我不是开发人员,只是一个卑微的网络工程师。它可能适用于不同的内核版本,其中该选项未在您正在运行的版本中完全实现,即使该选项已设置。您也可能需要安装内核模块。我会将它作为一个错误提交给 OpenWRT。

是的,你可以把它放在热插拔中。唯一的事情是获得 GARP 的正确界面。也许从 readlog 中的 grep/awk 最新的接口将其拉到接口变量中。您也可以只创建两个脚本。或者更巧妙的是,您也可以将 garp ping 转换为一个函数,使用不同的参数为不同的接口运行两次。

让我们知道你的结局如何。

(最后由sloppyTypist于 2017 年 2 月 19 日 00:10 编辑)

 

============== End

 

 
posted @ 2020-09-28 20:20  lsgxeva  阅读(269)  评论(0编辑  收藏  举报