How to set up a static/persistent ARP entry with OpenWRT 14.07, Barrier Breaker?

The title say it all, but here is the long version:

I am trying to setup a way for my home server to automatically turn on using WakeOnLan, when a client tries to access it. My idea is that the router (OpenWRT 14.07, Barrier Breaker) monitors any connection attempts to the host I want to wake up using iptables and in the case it registers such an event it sends the magic packet to wake the host. After lots of trying and help on SF, I have gotten iptables to work for the bridged device and thus local network (see here).

Unfortunately I now ran into the problem that, if the host is turned off, no ARP entry exists for it and thus local clients will not send any packets, when they cannot resolve the IP (if I have understood the problem correctly). For external clients accessing from the internet it works.

If I understand correctly, the solution should be to create a static ARP entry, so that the router will respond to any requests and then the clients will send their packet. Following this I have tried using the ip neigh add 192.168.1.20 lladdr 00:de:ad:be:ef:00 nud permanent dev br-lan and running arp I see an entry for the server, but it still does not work.

I have confirmed, that when the server is turned on or was recently turned off (a few minutes prior), the clients do send packets, which are logged by iptables.

So the questions are:

1) What am I doing wrong?

2) How do I achieve a static/persistent ARP entry on the?


Solution 1:

I was able to use

ip neighbor replace 192.168.0.1 lladdr 11:22:33:44:55:66 nud permanent dev eth0

or if not requested already

ip neighbor add 192.168.0.1 lladdr 11:22:33:44:55:66 nud permanent dev eth0

To set the IP address to the MAC address.

Solution 2:

The correct way to have static ARP entries is to setup an external file, usually called /etc/ethers, with the format:

   00:11:22:33:44:55 192.168.1.2
   aa:bb:cc:dd:ee:ff 192.168.1.3

and so on, then to add the following line

   post-up arp -f /etc/ethers

(I do not know the iproute2 equivalent of arp -f, but this command stil lworks on kernel 14.04) In the stanza for the br-lan interface in teh file /etc/network/interfaces.

As to why your command; I do not know, it looks ok to me. What is the name of your bridged interface? In your example it is br-lan, you should have changed as per your needs.