Back to Engineering Blog
Engineering Field Notes 5 min read

Wake-on-LAN at Scale: Automating Post-Storm Fleet Recovery Across Routed Subnets

Automated UPS shutdowns protect servers during power outages, but waking 15+ nodes remotely is tricky across routed subnets. Here is how we automated fleet power-on with persistent driver flags and on-subnet relays.

Jason NevillBy , Houston, TX
#Automation#WakeOnLAN#PowerResilience#Linux

Key Architectural Takeaways

  • Wake-on-LAN magic packets are Layer 2 local broadcasts that cannot cross routed VLAN boundaries or VPN tunnels directly.
  • Modern Linux network drivers often reset Wake-on-LAN to disabled on reboot unless explicitly persisted via systemd.
  • An on-subnet relay node reachable via secure mesh VPN bridges remote power-on commands to physical switch broadcast domains.

The other half of power resilience

Most infrastructure guides dedicate considerable ink to graceful shutdown: installing Network UPS Tools (NUT), configuring battery thresholds, orchestrating virtual machine pausing, and cleanly unmounting filesystems before batteries drain.

We built all of that. But the first time a severe Texas thunderstorm knocked out utility power for two hours, we encountered the operational reality of post-storm recovery:

  • The UPS units performed flawlessly, shutting down 15+ physical nodes without a single corrupted database block.
  • But once main power stabilized and battery banks recharged, every single server remained dead cold.

Walking between equipment racks in the dark to press physical chassis power buttons one by one is neither scalable nor practical when operating remotely. We needed deterministic remote fleet power-on automation.

Challenge 1: The Layer 2 broadcast boundary

Wake-on-LAN operates by transmitting a "magic packet"—a raw Ethernet frame containing a 6-byte synchronization stream of 0xFFFFFFFFFFFF followed by 16 consecutive repetitions of the target device's 48-bit MAC address.

Because the target computer is in an ACPI S5 (powered-off) state, it has no IP address, no ARP table entry, and no TCP/IP stack running. Its physical NIC listens purely for raw Layer 2 broadcast frames on its local physical switch port.

This introduces a fundamental routing barrier:

  • Standard enterprise routers and firewalls deliberately drop Layer 2 broadcast frames at the subnet boundary to prevent broadcast storms.
  • Remote administrators connecting over WireGuard or Tailscale operate at Layer 3 (or tunneled Layer 3), which cannot propagate raw L2 Ethernet broadcasts across physical network segments.

Challenge 2: The resetting driver trap

Enabling Wake-on-LAN in motherboard BIOS settings is necessary, but rarely sufficient under modern Linux kernels.

During testing on several thin clients, we enabled WoL in firmware, confirmed it with sudo ethtool -s eth0 wol g, and shut the system down. The first wake packet succeeded. But after the host booted and was subsequently shut down a second time, it refused to wake up.

Investigating the driver state revealed that during Linux kernel shutdown, the network driver (notably the r8169 Realtek module) re-initialized the PCIe controller and reset the register state back to Wake-on: d (disabled). Unless the operating system re-asserts the wol g flag immediately before interface teardown, the hardware goes to sleep deaf to magic packets.

To make the setting durable, we created an automated systemd unit deployed across all physical targets:

[Unit]
Description=Persist Wake-on-LAN Magic Packet Support
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/ethtool -s eth0 wol g

[Install]
WantedBy=basic.target

The architecture: An on-subnet broadcast relay

To bridge remote management tools to physical switch fabrics without opening risky subnet-directed broadcast exceptions on our firewall, we designated a low-power, always-on thin client as an on-subnet WoL relay:

  1. The relay node consumes under 5 watts of power and is connected directly to the primary physical switch backplane.
  2. It runs our secure mesh overlay (Tailscale SSH), making it securely reachable by authenticated operators from anywhere in the world.
  3. It hosts our centralized hardware registry (wol_hosts.yml), mapping hostnames to verified physical MAC addresses.
  4. A single command on the relay transmits raw socket broadcasts directly onto the local wire:
# Operator triggering fleet recovery from remote terminal
fleet-poweron --group hypervisors

The relay executes wakeonlan locally, flooding the physical switch ports with the required magic packets. Nodes receive the frames on their standby power rails and power on in orchestrated waves (hypervisors first, followed by storage appliances and compute nodes) to prevent inrush current spikes on the UPS.

Verification

During scheduled drills:

  1. Four physical nodes were powered down into S5 cold-off state.
  2. The remote fleet-poweron command was executed over a mobile mesh connection 50 miles away.
  3. All target nodes successfully detected the broadcast frames, initiated POST, booted into their operating systems, and rejoined the cluster in under 120 seconds.

Engineering takeaway

A disaster recovery plan that requires physical hands on chassis power buttons is incomplete. Persisting NIC driver power registers and deploying an on-subnet relay node transforms Wake-on-LAN from a finicky desktop trick into an automated, enterprise disaster recovery workflow.

Some of what's described here is a design that hasn't been fully tested yet; those parts say so in the text.

Follow the build on LinkedIn or by RSS.

All Articles

Follow the build

Questions about the build, or spotted something we got wrong? Find us on LinkedIn and GitHub.