Linux – How to send a magic packet from linux to Windows

ethernetlinuxnetworkingwake-on-lanwireless-networking

I'm trying to wake my PC using WOL (Wake on LAN) from my pi. I enabled Wake on LAN in the device manager for my ethernet adapter and enabled it in my bios. When the computer is switched off, the lights of the ethernet port are on.

Now, on my pi, this is how I tried to send the magic packet :

root@raspberry:~# wakeonlan 00:11:22:33:44:55
Sending magic packet to 255.255.255.255:9 with 00:11:22:33:44:55

When I send this command, I get a message that it is sending the packet, but my PC does not switch on.

00:11:22:33:44:55 is the mac address of my ethernet port on my windows. The pi and my PC are on the same network. I'm trying this for the first time, so please comment if I've done anything dastardly stupid.

My PC runs Windows 7 Ultimate.
Pi runs Raspbian (linux).

Note : I replaced my real mac address with the one above.

Best Answer

Your command looks correct. So I would next go to the Windows PC to troubleshoot using a traffic capture tool.

To see if the packet is actually getting to the PC, you can install Wireshark, select the relevant interface to monitor, start the capture and then type 'wol' in the display filter. Then send a wakeonlan packet to the windows machine from your Pi again. You should see this traffic come up in the capture.


Additional Information

WOL Behavior Note, WOL will only work on the same subnet in your example, as MAC Addresses are a Layer 2 addressing method that only spans a single broadcast domain.

MAC Address Structure The first three blocks (::**) should be vendor unique for physical hardware. Virtual Machines are the only devices that, by default, bypass the MAC Addressing standard. You would have to manually tell a physical device to mascarade its MAC address.

Better Ways to Get Your MAC Address Secondly, a better way to get your MAC address is by going to the Command Prompt and typing ipconfig /all. OR Start > Control Panel > Network & Internet > Network & Sharing Center > Change Adapter Settings > Right-Click (the relevant interface) > Status > Details The Physical Address is your MAC address and will use '-' instead of ':'. Note that you still have to use ':' with the wakeonlan command on your Pi.

I hope the above helps. Sorry if this is unclear, I am new to posting on superuser

Wireshark Capture Setup Example - 1:

Wireshark Capture Setup Example - 1

Wireshark Capture Setup Example - 2:

Wireshark Capture Setup Example - 2

Related Question