No Gratuitous ARP Message on Reboot or IP Change?

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

 

Post #1
michaeluray
16 Feb 2017, 18:37

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)

 

Post #2
sloppyTypist
17 Feb 2017, 05:12

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:

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

 
Post #3
michaeluray
17 Feb 2017, 18:16
sloppyTypist wrote:

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

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?

Post #4
sloppyTypist
19 Feb 2017, 00:08

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)

 

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