December 5, 2026

Wake-on-LAN on Linux: What the Magic Packet Looks Like and How to Set It Up

A sleeping desktop computer with a glowing network port light

A sleeping computer can be woken by a frame that contains nothing but a run of 0xFF bytes and the machine’s own hardware address typed out sixteen times. No login, no protocol handshake, no reply. Two magic packets were sent across a virtual Ethernet link built for this post, one with each of the two common Linux tools, and both were captured byte for byte. What’s inside explains nearly every Wake-on-LAN failure people run into: why it works on the same network and not across a router, why the IP address barely matters, and why the setting keeps turning itself off.

Video: Christian Lempa on YouTube

The packet, byte by byte

Sixteen copies of one address

The format comes from AMD’s Magic Packet white paper, which says the wake-up sequence “consists of 16 duplications of the IEEE address of this node.” AMD’s current Versal technical reference manual spells out the full pattern a controller looks for: “at least 6 bytes of 0xFF for synchronization,” followed by “16 repetitions” of the station address. Six bytes plus sixteen six-byte copies is 102 bytes.

What the capture showed

The receiving end of the test link had the MAC address 9a:91:9b:f2:46:a3. The wakeonlan command was pointed at it:

$ wakeonlan -i 10.77.0.255 9a:91:9b:f2:46:a3
Sending magic packet to 10.77.0.255:9 with 9a:91:9b:f2:46:a3

tcpdump on the receiving side reported UDP, length 102, and the hex dump showed the payload starting with ffff ffff ffff and then 9a91 9bf2 46a3 repeated until the frame ended. The Ethernet destination, the first six bytes of the frame, was also ffff ffff ffff: a broadcast that every machine on the segment receives.

Reading the layers in the dump

The bytes before the pattern tell the rest of the story. After the six-byte broadcast destination and the sender’s six-byte MAC came 0800, the ethertype for IPv4. The IP header that followed began 4500 0082: version 4, a 20-byte header, and a total length of 0x82, or 130 bytes. A few bytes later sat 11, the protocol number for UDP, preceded by 40, a time-to-live of 64. Then the UDP header: source port 0xec68, destination port 0009, and a length of 0x6e, which is 110 bytes, the eight-byte UDP header plus the 102-byte pattern. Only after all of that did the ffff ffff ffff synchronization run begin. Everything up to that point is packaging the network card ignores while it hunts for the pattern.

The IP address is just an envelope

That UDP packet was addressed to 10.77.0.255 on port 9, but nothing in the wake-up logic reads either one. The sleeping network card isn’t running an IP stack. It scans incoming frames for the pattern. AMD’s white paper notes the destination can be the station’s own address or “a MULTICAST address which includes the BROADCAST address,” and the pattern can sit anywhere in the data. UDP is just a convenient way for an ordinary program to put those bytes on the wire.

Silver skeleton keys on a brown wooden table

Two tools, two kinds of frame

wakeonlan sends UDP

The wakeonlan package, as captured above, wraps the pattern in a UDP datagram to a broadcast IP address. Because it uses an ordinary socket, it runs as a normal user and can be told which broadcast address and port to use.

etherwake sends raw Ethernet

etherwake skips IP entirely. Run as root against the same MAC, it produced a different frame:

22:04:89:dc:a5:2b > 9a:91:9b:f2:46:a3, ethertype Unknown (0x0842), length 116

This time the destination was the target’s own MAC rather than broadcast, and the frame carried ethertype 0x0842 with no IP header. The payload was the same: six bytes of 0xFF, then the address sixteen times. Because it has no IP layer, an etherwake frame can only reach machines on the same Ethernet segment, and it has to be told which interface to send on with -i.

Which to use

On a flat home network either one works. wakeonlan is easier to script from an unprivileged account; etherwake avoids any confusion about broadcast addresses. Both need the target’s MAC address, which can be read on the sleeping machine ahead of time with ip link show.

Turning it on in the network card

ethtool’s wol letters

The card has to be armed before the machine sleeps. The ethtool manual page describes wol with a caveat worth taking literally: “Not all devices support this.” Its argument is a string of letters, and the one that matters here is g, “Wake on MagicPacket™.” Others include u for unicast, b for broadcast and a for ARP. The letter d means “Disable (wake on nothing).”

sudo ethtool eth0 | grep -i wake
sudo ethtool -s eth0 wol g

The first command shows Supports Wake-on: and the current Wake-on: value. The second arms magic-packet wake.

When the card says no

On the virtual link used for the tests, ethtool -s wb wol g returned netlink error: Operation not supported, and the status listing had no Wake-on lines at all. Virtual interfaces, many USB adapters and some Wi-Fi chips behave the same way. If Supports Wake-on: doesn’t include g, no amount of configuration will help.

A Wi-Fi router and a network switch side by side

Making it survive a reboot

Why it keeps turning off

A setting made with ethtool -s lives in the driver until the next boot, and some drivers reset it when the interface goes down. That’s why Wake-on-LAN often works once, after someone runs the command by hand, and then never again.

NetworkManager

On desktops managed by NetworkManager, the connection profile carries its own Wake-on-LAN setting. The project’s settings reference lists the wake-on-lan property with values including “0x40 (magic)” and the special “0x1 (default),” meaning use global settings. In nmcli it’s set by name:

nmcli connection modify "Wired connection 1" 802-3-ethernet.wake-on-lan magic

systemd .link files

On servers using systemd-networkd or udev’s link configuration, a .link file does the same job. The systemd.link manual documents WakeOnLan= with the value magic, “Wake on receipt of a magic packet,” and says the setting “Defaults to unset, and the device’s default will be used.” A minimal file matches the card by MAC address and sets WakeOnLan=magic.

The firmware has a vote

BIOS and UEFI

The card can only wake the machine if the motherboard keeps it powered while asleep and listens to it. Most boards hide this under a power-management menu with a name like “Wake on LAN,” “Power On by PCI-E” or “Resume by LAN,” and some ship with it off. Some boards also cut power to the network card entirely in their deepest low-power modes, sometimes labeled ErP or EuP, which defeats Wake-on-LAN.

Sleep versus off

Whether a machine can be woken from full shutdown, rather than suspend, depends on the board and on how the operating system shut down. A quick test: after ethtool -s eth0 wol g, suspend the machine, check that the network port’s link light stays lit, and send the packet. A dark link light means the card has no power and can’t hear anything.

A road closed sign on the side of a road

Across a router

Directed broadcasts are blocked by default

Because the usual magic packet is a broadcast, it stops at the edge of the local network. Sending it to a remote subnet’s broadcast address, a so-called directed broadcast, used to be possible. RFC 2644, from August 1999, changed the rule for routers: these options “MUST default to blocking receipt and blocking forwarding of network-prefix-directed broadcasts.” Directed broadcasts had been used to amplify attacks, so most equipment refuses them.

What works instead

The reliable approach is to send the packet from a machine already on the sleeping computer’s network: an always-on mini PC, a NAS or a router that has its own wake-up function, reached over SSH or a VPN. Forwarding a router port to a broadcast address can work on some home routers, but it opens a hole for a packet anyone on the internet can send.

SecureOn passwords

Some cards accept a six-byte password appended to the pattern. The ethtool s letter enables it and sopass sets it, in “Ethernet MAC hex format.” systemd’s WakeOnLanPassword= does the same. It isn’t encryption, since the password crosses the network in the clear, but it does stop a stray magic packet from waking the machine.

A checklist that finds the fault

In order

  1. ethtool eth0: does Supports Wake-on: include g, and is Wake-on: set to g?
  2. Is it set persistently, through NetworkManager or a .link file?
  3. Is Wake-on-LAN enabled in the firmware, and is the deep power-saving mode off?
  4. Is the link light on while the machine sleeps?
  5. Is the sender on the same network segment, using the right MAC address?
  6. If it still won’t wake, run tcpdump -e ether proto 0x0842 or udp port 9 on another machine on that segment and confirm the packet is being sent.

Most failures turn up at step 2 or step 3. The packet itself, as the capture showed, is about the simplest thing on the wire.

Sources

  • AMD, “Magic Packet Technology” white paper: https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/white-papers/20213.pdf
  • AMD, Versal ACAP Technical Reference Manual (AM011), “Magic Packet Events”: https://docs.amd.com/r/en-US/am011-versal-acap-trm/Magic-Packet-Events
  • ethtool(8) manual page, man7.org: https://man7.org/linux/man-pages/man8/ethtool.8.html
  • NetworkManager, 802-3-ethernet settings: https://networkmanager.dev/docs/api/latest/settings-802-3-ethernet.html
  • systemd.link manual: https://www.freedesktop.org/software/systemd/man/latest/systemd.link.html
  • RFC 2644, “Changing the Default for Directed Broadcasts in Routers”: https://www.rfc-editor.org/rfc/rfc2644.html

920 Posts

Peter Kalafatis writes and edits X9M8. He holds a bachelor's degree from LIU Post and a master's in Media Studies from The New School, with academic work in the philosophy of science, human behavior, AI, and memetics.

View All Posts

Leave a Reply

Your email address will not be published. Required fields are marked *