zoukankan      html  css  js  c++  java
  • No Gratuitous ARP Message on Reboot or IP Change?

    No Gratuitous ARP Message on Reboot or IP Change?

    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)

     

    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

    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?

    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

  • 相关阅读:
    字体
    当前li的同级且不包含当前li
    溢出用省略号显示
    .NET Core中使用Cookie步骤
    .NET Core中使用Session步骤
    asp.net core 读取配置
    Asp.Net Core run on Ubuntu
    .net core中使用GB2312编码
    ubuntu mysql 安装
    samba的安装
  • 原文地址:https://www.cnblogs.com/lsgxeva/p/13746683.html
Copyright © 2011-2022 走看看