7

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?

1
  • Be sure that the host you are adding the entry for has a static IP defined on that host (dont use DHCP). I had issues with DHCP interfering with static arp entries on OpenWRT. Aug 6, 2023 at 15:05

2 Answers 2

4

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.

1
  • 2
    You need ip-full package installed for these commands to work. Jul 20, 2018 at 12:01
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.

4
  • Ok. So I got a working arp command in OpenWRT by installing opkg install net-tools-arp. When I now use arp -s 192.168.1.20 00:11:22:33:44:55 -i br-lan, it shows up in the arp table as: 192.168.1.20 ether 00:11:22:33:44:55 CM br-lan. So I would expect it to work, but is still does not. Running sudo arpsend -D -e 192.168.1.20 wlan0 on my laptop, it just hangs and does not give back anything.
    – packoman
    Jun 15, 2015 at 20:17
  • Furthermore, I couldn't find the post-up script, but when editing /etc/ethers, I found this for the boot-up in the logs: Mon Jun 15 21:11:49 2015 daemon.info dnsmasq-dhcp[1395]: read /etc/ethers - 1 addresses. So Is there anything else I can try? Any suggestions for debugging/testing this? Thanks for your help so far BTW!
    – packoman
    Jun 15, 2015 at 20:18
  • Oh. And with regards to the device: The bridge device is called br-lan, so that should be good.
    – packoman
    Jun 15, 2015 at 20:20
  • @packoman I made a small mistake in my answer,now corrected, about the file where to put that line. Pls re-read my answer. Sorry about that. Jun 15, 2015 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .