Skip to content

Make Wake-On-LAN more reliable #88

@porst17

Description

@porst17

Sometimes, PCs do not wake up after a WOL magic packet has been sent.

If we ignore problems on the station side, I can see the following reasons why WOL might fail:

  • Sending the WOL packet to a specific IP address relies on static ARP caches. If the mapping between IP and MAC is not contained in the ARP cache, the magic packet will not be forwarded at all.
  • The magic packet is usually an UDP packet (to port 9 - the discard port). UDP packets can get lost or be corrupted without further notice. It is unlikely, but still possible. I've read numbers ranging from 0.01% to 5% packet loss to be normal, depending on the environment you are in. A slightly bad cable can also be the origin of packet loss. Also heavy load on the network.

The first problem can be addressed by sending the magic packet to the broadcast address 255.255.255.255 (or whatever is appropriate for the network hilbert is running in). Sending it to both, the broadcast address and previously known IP, will not hurt as well. The second problem can be addressed by sending the magic packet a couple of times.

I could also imagine hilbert-cli start_station to block (with a timeout) until the requested host answers on ping, e.g. something like this (pseudo code):

var PING_EXIT_CODE;
do
    wakeonlan -i broadcast_address mac
    wakeonlan -i ip_from_arp_cache mac
    PING_EXIT_CODE = (ping -o -t 5s hostname)
while( PING_EXIT_CODE != 0 && !GLOBAL_TIMEOUT )
if( PING_EXIT_CODE != 0 || GLOBAL_TIMEOUT )
    return FAILURE
else
    return SUCCESS

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions