Why WakeOnLAN frames are sent to broadcast

I'm trying to figure out why wake on lan frames, in the simplest form, are designeted to the ethernet broadcast address (FF:FF:FF:FF:FF:FF) and not to the address of the machine to be powered on.

Does it has to do with the network switch internal table that assings a mac address to ports?


Solution 1:

According to AMD's spec the destination doesn't have to be the all-ones address. It can also be the receiving station's address or a multicast address. The payload is a different story. It must be the sequence ff:ff:ff:ff:ff:ff followed by the receiving station's MAC address repeated 16 times.

The presence of absence of the station's entry in the switch's CAM table shouldn't matter in this case. If the entry isn't present the packet should be forwarded out all ports.

Solution 2:

Yes. Since the mappings expire after some time (generally it's 4 hours if I recall correctly), it needs to be broadcast so it has a chance of reaching the target machine after the mappings are gone.

Edit:

Correction: If the mappings expire, the message is broadcast anyway.

The only reason why you would need to use broadcast is in case the machine physically moved to a different port and you tried to use Magic packets to wake up the machine before the mappings expired. Sounds like that would be handy in a datacenter, but I can't say if it's actually used.

While the example I've given probably never happens, it's likely the reason why broadcast is generally chosen - it's more reliable in case of bad/outdated mappings.