Enable Wake-on-LAN on Fedora with a Realtek r8169 NIC
Contents
This sets magic-packet Wake-on-LAN on the wired NetworkManager connection of a Fedora-family host with a Realtek r8169 NIC, so the NIC stays awake after shutdown and the host powers on when a MikroTik router sends /tool/wol.
- Tested on
- four Fedora-family hosts with Realtek r8169 NICs (the workstation and a mini PC on Fedora, the gaming PC on Bazzite, the storage box on Fedora), set with the script below; wake from power-off tested on two of them with a MikroTik router's
/tool/wol. The setting was re-checked on the workstation on 2026-11-02 (Fedora 44 NetworkManager 1.56.1, ethtool 7.1, kernel 7.2.13). - Not verified
- OS, NetworkManager, ethtool and RouterOS versions of the first run
[UNVERIFIED: not recorded]; a wake test on the other two hosts; the rollback. - Needs
- root on the host; Wake-on-LAN enabled in the BIOS/UEFI setup (check it there; I know of no way to read it from Linux); a wired link to the same LAN segment as the router; a RouterOS login that may run
/tool/wol. - Time
- 5 min per host, plus one power-off test.
- Risk
- the test powers the host off. After the change, anyone on the LAN segment who knows the NIC's MAC can power the host on: these NICs report
Supports Wake-on: pumbg, with nos, so they cannot check a SecureOn password, and RouterOS's/tool/wolcannot send one either. Reversible: see Undo.
Before you start#
- Placeholders used below:
<IF>: the wired interface name (mine:enp1s0).<CONN>: the NetworkManager connection on that interface (mine:Wired connection 1).<MAC>: the MAC address of<IF>.<BRIDGE>: the router interface that faces the host's LAN segment (mine:bridge).
- Check that the wired NIC uses
r8169:Expected: a path ending in$ readlink -f /sys/class/net/enp1s0/device/driver /sys/bus/pci/drivers/r8169r8169. The steps set generic NetworkManager and ethtool options, but r8169 is the only driver I ran them on. - Find the active wired connection and its device:
$ nmcli -t -f NAME,DEVICE,TYPE c show --active | grep 802-3-ethernet Wired connection 1:enp1s0:802-3-ethernet - Record the current values; Undo sets them back. In a root shell, run
nmcli -g 802-3-ethernet.wake-on-lan c show '<CONN>'andethtool <IF> | grep Wake-on. On all four of my hosts the first printeddefault, and ethtool showedSupports Wake-on: pumbgandWake-on: d, with Wake-on-LAN already on in the BIOS.dmeans the NIC wakes on nothing; ethtool(8) lists the letters, andgis the magic packet. - Note the MAC for the router step:
cat /sys/class/net/<IF>/address.
Steps#
- Save the script as
enable-wol.sh. It walks every active wired connection, sets802-3-ethernet.wake-on-lan magicin NetworkManager (stored in the connection, applied on every activation) andwol gwith ethtool (applied now, no reconnect), then prints both values back.#!/bin/bash # Enable Wake-on-LAN (magic packet) on the wired NetworkManager connection. Run as root. # Persistent: NM applies it on every activation. Immediate: ethtool, no reconnect. set -euo pipefail E=$(command -v ethtool || echo /usr/sbin/ethtool) nmcli -t -f NAME,DEVICE,TYPE c show --active | while IFS=: read -r n dev t; do [ "$t" = 802-3-ethernet ] || continue nmcli c modify "$n" 802-3-ethernet.wake-on-lan magic "$E" -s "$dev" wol g echo "$(hostname) $dev '$n': nm=$(nmcli -g 802-3-ethernet.wake-on-lan c show "$n") $("$E" "$dev" | grep -E '^\s*Wake-on:' | xargs)" done - Run it as root.Expected: one line per wired connection, in the form
sudo bash ./enable-wol.sh<hostname> <IF> '<CONN>': nm=<VALUE> Wake-on: <LETTERS>, ending innm=magic Wake-on: g. All four hosts printed that ending. I did not keep the full lines, so none is shown here. The script runs withset -euo pipefail: if a command fails, it stops there with a non-zero exit, without a line for that connection. - Power the host off.Expected: the host shuts down. Leave its power cable in: Wake-on-LAN needs standby power at the NIC.
sudo systemctl poweroff - Send the magic packet from the router.Expected: the host powers on and boots. In my test I powered two hosts off at 22:45:53, sent the packet at 22:46:21, and they booted at 22:46:40 and 22:46:45, 19 s and 24 s after the packet. If it stays off: see Failure modes, row 1.
/tool/wol mac=<MAC> interface=<BRIDGE>
Verify#
- After the wake, in a root shell on the host, run
ethtool <IF> | grep Wake-on. Expected:Wake-on: g. On my woken hostsWake-on: gwas still set after boot. NetworkManager appliesmagicon every activation of the connection; the ethtool call in the script only sets it right away, without a reconnect. - The NetworkManager value can be read without root. On the workstation on 2026-11-02:Expected:
$ nmcli -g 802-3-ethernet.wake-on-lan c show "Wired connection 1" magicmagic.
Undo / rollback#
- In a root shell, set back the values you recorded in Before you start (mine:
defaultandd). The script changed every active wired connection: repeat this for each<CONN>and<IF>it printed.nmcli c modify '<CONN>' 802-3-ethernet.wake-on-lan default ethtool -s <IF> wol d[UNVERIFIED: rollback not exercised]
Failure modes#
| Symptom (exact message) | Cause | Fix |
|---|---|---|
The host does not wake from power-off although the BIOS has Wake-on-LAN on; root ethtool <IF> shows Wake-on: d | the connection had 802-3-ethernet.wake-on-lan default, and the NIC was powered down at shutdown | steps 1-2: set magic on the connection |
netlink error: Operation not permitted, and no Wake-on lines in the output | ethtool run as a normal user: reading Wake-on needs root | run ethtool <IF> from a root shell |
Field notes#
- 2026-11-02, the workstation, Fedora 44 (KDE Plasma Desktop Edition), kernel 7.2.13-200.fc44, NetworkManager 1.56.1, ethtool 7.1, r8169 on
enp1s0: re-checked as a normal user. NetworkManager still hadmagicon the wired connection. ethtool printednetlink error: Operation not permittedand the rest of the link settings, with no Wake-on lines at all, so a user-level ethtool cannot show the NIC's Wake-on state. I did not re-read Wake-on as root this time. - 2026-10-20
[UNVERIFIED: date from my project notes, not from the run's output], four hosts (the workstation and a mini PC on Fedora, the gaming PC on Bazzite, the storage box on Fedora), all Realtek r8169, versions not recorded: Wake-on-LAN was on in the BIOS of every host, and none of them stayed wakeable: ethtool showedSupports Wake-on: pumbgwithWake-on: d, and the wired NetworkManager connection had802-3-ethernet.wake-on-lan default, so the NIC powered down at shutdown. I ranenable-wol.shon all four; each printednm=magic Wake-on: g. Then (same day or later, the test's date was not recorded) I powered two of them off at 22:45:53, sent/tool/wol mac=<MAC> interface=bridgefrom the MikroTik router at 22:46:21, and they booted at 22:46:40 and 22:46:45.Wake-on: gwas still set after boot.
Notes#
- Why I needed it: the hosts run on power stations that keep their outlets live through an outage, so a host that
upsmonshut down never sees power disappear and never comes back by itself (the observer design post). That design has the observer send Wake-on-LAN after an outage; here I sent the packet from the router by hand. When a station's output did drop on 2026-11-02, the storage box came back by itself, probably through the BIOS power-on-after-AC-loss setting, which I have not checked (three shutdowns, three causes). Theupsmonside is in Run upsmon as a NUT secondary on Fedora and Fedora Atomic. - Only
g: the NICs also supportp,u,mandb(wake on PHY activity, unicast, multicast, broadcast); each of those can wake the host on ordinary traffic. I enabled the magic packet only. defaultis not "off" by name: per the nmcli settings reference,defaultmeans "use global settings", andignorestops NetworkManager from managing Wake-on-LAN at all. A global value in NetworkManager.conf (ethernet.wake-on-lan) is another way to set it for every connection; I have not tried it.- ethtool path: the script uses
ethtoolfromPATHand falls back to/usr/sbin/ethtool. - Router without
interface=: per the MikroTik docs, RouterOS then sends the packet as an IP broadcast from the default gateway interface. I always gave the interface.
Filed under: fedora, linux, networking, mikrotik, ups
Sources#
- nmcli settings reference,
802-3-ethernet.wake-on-lan: the flag valuesmagic,default(use global settings) andignore. - NetworkManager.conf:
ethernet.wake-on-lanas a global per-device default. - ethtool(8): the
wollettersp u m b a g s f d. - MikroTik RouterOS: Wake on LAN:
/tool wolwithmacandinterface; no SecureOn support.