Adding a MAC address to the ARP cache on startup

Hi there,

I am using WOL to power on a device on the local network. After some time, the MAC address of this device is deleted from the ARP cache, so to use WOL for this device again I have to add this address with e.g.:
# ip neigh replace dev enp23s25 lladdr aa:bb:cc:dd:ee:ff

Of course then it works. But I want this to happen automatically after booting, for more comfort.

My only approach is to use systemd timers or cronjob, but there would be a security risk, right?

Hope someone can help me out.
Thanks in advance!

Can you give more info? You’re sending WOL packet from local network? Can’t you just use broadcast?

The command I use to wake up the device is:
wol --host= aa:bb:cc:dd:ee:ff

I can´t find an option to send a broadcast, so I guess the mac-address ff:ff:ff:ff:ff:ff is what you mean? besides that it would not be useful in my opinion since this could potentially wake up all wol device on the network, right?

Not sure about wol exactly, but I use wakeonlan.

wakeonlan -i OP:TI:ON:AL:MA:CA:DD:RE:SS

I actually don’t think the mac is necessary. The problem is you broadcast to the entire subnet so all machines on that net will wake.

But reading the man page for wol I learn:

Broadcast packet to this IP address or hostname. This is important if your wol client is a multihomed host and you want to send only to one subnet (default IP address is

Try using --ipaddr instead of --host

wol --ipaddr= aa:bb:cc:dd:ee:ff

Also, not sure if it was a typo or if it’s the actual line you use, but remove the space between = and ip

Of course it’s necessary, it’s the actual payload.

Try skipping “–host=” part.

Works on mine without it, I just keep it in my wol script as a reminder of what my actual mac is.

Thank you for the replies.
You are right, that´s a typo in the command I posted. However, after I reboot my Computer the ARP cache is flushed. Alternatively this can be done with the ip neigh flush command aswell.

ip neigh doesn´t show the device I want to wake up, and thats the problem. Without the MAC I can not send the package to the destination.

Perhaps, maybe I got it wrong? I suppose I need to have the MAC in the ARP cache.

Magic packets (also known as wake on lan) is broadcasted on the entire network. The ip is a limit to what network.

1 Like

I get it now. I just got rid of the --host part, and it works now. Thank you guys.

1 Like

One way or another the mac address has to be inserted in the packet itself. Do a packet capture and see for yourself.

You are correct.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.