Wake-on-LAN: Unicast is not working. Why

networkingwake-on-lan

I am facing a strange problem while setting up wake-on-LAN in our company network.

The following is true for the workstation to be waked-up:

  • WOL is enabled in the BIOS and in the settings of the network card
  • The router will always assign the same IP address to that workstation (MAC address)
  • The network card is configured to obtain the IP address automatically

The workstation that sends the WOL command is in the same subnet as the workstation to be waked up.
Now the following scenarios happen if I try to wake up the machine:

Start Condition: Machine was turned off for one or more days

  • If I send the WOL command via network broadcast (only allowed for testing), the machine wakes up successfully
  • If I send the WOL command directly to that workstation (using IP address, subnet mask, DNS name) the machine will not wake up.
  • Only if I have started the machine manually at least once, the machine can be waked up afterwards by sending the WOL command directly to its IP address.

Does someone have an idea why the machine cannot be waked up directly via its IP address if it was turned off for a longer time and why this works if I use "Broadcast" as WOL method?

Any response is highly appreciated.

Best Answer

As @ott's comment mentions, you can't send unicast traffic to a machine that isn't active on the network at that time. 'Active on the network' means different things to different devices though... to a Layer 3 device like your PC or a router it means 'this device has talked to the machine at some time in the last 4 hours' (depends on arp timeout), to a Layer 2 device like a switch it means 'the switch has seen a packet with that source mac-address some time in the last 5 minutes' (depends on mac aging time).

You state that unicast WOL works when the device has been turned on and then back off, but you don't state if it stops working at some time after the machine is shut off. This works because the router (or the WOL-packet generating PC if in the same subnet) has an arp entry (4 hour timeout) and can create a packet destined for the correct machine, however the switch either knows the port the mac-address belongs to (WOL sent within mac aging time) or has already timed out that mac-address so it treats the unknown destination as a broadcast. Once the arp entry times out, the router (or PC) will fail to encapsulate the WOL packet since it has nothing to put in the dest-mac field.

To make this work you need to use broadcasts, there is no other reliable way. To make WOL work on a different network than where your server is connected, you need to use directed broadcast packets (unicast packets sent to broadcast address of remote network, properly configured remote router will allow the packet and send it as a broadcast on the intended network).