Wake-on-LAN: Turning Machines On Remotely
Wake-on-LAN (WoL) allows you to turn on a machine that is plugged in but powered off by sending it a special broadcast message, known as a magic packet. This feature can be useful for waking up big power-hungry machines like gaming PCs or servers when needed. The homelab use case involves having these machines sleep when idle and wake only when required, reducing power consumption.
Setup Checklist
To set up WoL, you need to ensure that the necessary components are configured correctly at multiple layers: BIOS/UEFI settings, operating system configurations, wired Ethernet requirements, and sender tools. Here’s a step-by-step guide:
1. BIOS/UEFI Settings
- Enable "Wake on LAN" or "Power On by PCIe": This setting allows the network card to stay powered slightly longer than usual so it can receive the magic packet.
- Check Deep Sleep/Energy Star (ErP) Settings: Ensure that these settings do not fully power off the network interface card, as this would prevent WoL from working.
2. Operating System Configuration
Windows:
- Open Device Manager and navigate to your network adapter.
- Go to Power Management and ensure "Allow this device to wake the computer" is checked.
- In Advanced settings, enable "Magic Packet."
- Note that Fast Startup can interfere with waking from a full shutdown. Classic startup should be used instead.
Linux:
- Use
ethtoolto configure WoL:sudo ethtool -s eth0 wol g - Persist this setting via systemd/udev or NetworkManager, as it resets on boot otherwise.
- Use
3. Wired Ethernet Only
- Wired Ethernet Requirement: Wake-on-LAN over wireless (Wi-Fi) is not reliable and practically unsupported due to the nature of broadcast packets not routing across the internet naturally.
- Always Use a Cable: The sleeping machine must be connected via a wired Ethernet connection for WoL to work.
4. Sender Tools
- Any WoL App/Tool: Tools like
wakeonlanon Linux or apps on smartphones can send the magic packet. You need the target's MAC address.
Waking Across the Internet
Waking a machine across the internet is more complex due to how broadcast packets are handled. Here’s the recommended approach:
- Do Not Send WoL from Outside: The magic packet is a Layer 2 (data link layer) broadcast and does not route naturally over the internet.
- Use an Always-On Device Inside the LAN: Instead, use a small device inside your local network that remains always on. For example:
- VPN/Tailscale into the LAN: Connect to your home network via a virtual private network (VPN) or a service like Tailscale and send the magic packet locally.
- SSH to the Pi: Alternatively, SSH into a Raspberry Pi or another small device that is always on and use it as a "wake dispatcher" to send the magic packet.
Troubleshooting
If your machine does not wake up:
- Check Sleep vs. Shutdown Settings: Ensure it wakes from sleep but not shutdown.
- NIC Link Light: Verify if the NIC link light stays on when the machine is supposed to be off (if dark, the firmware might be cutting power).
- Packet Delivery: Use
tcpdumpon another box to check if the magic packet reaches your local network. - ethtool Reset After Reboot: Ensure that the WoL settings are persisted after a reboot.
By following these steps and troubleshooting tips, you can effectively use Wake-on-LAN in your homelab setup.