Manual

Enable Wake-on-LAN on Fedora with a Realtek r8169 NIC

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 no s, so they cannot check a SecureOn password, and RouterOS's /tool/wol cannot 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:
    $ readlink -f /sys/class/net/enp1s0/device/driver
    /sys/bus/pci/drivers/r8169
    
    Expected: a path ending in r8169. 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>' and ethtool <IF> | grep Wake-on. On all four of my hosts the first printed default, and ethtool showed Supports Wake-on: pumbg and Wake-on: d, with Wake-on-LAN already on in the BIOS. d means the NIC wakes on nothing; ethtool(8) lists the letters, and g is the magic packet.
  • Note the MAC for the router step: cat /sys/class/net/<IF>/address.

Steps#

  1. Save the script as enable-wol.sh. It walks every active wired connection, sets 802-3-ethernet.wake-on-lan magic in NetworkManager (stored in the connection, applied on every activation) and wol g with 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
    
  2. Run it as root.
    sudo bash ./enable-wol.sh
    
    Expected: one line per wired connection, in the form <hostname> <IF> '<CONN>': nm=<VALUE> Wake-on: <LETTERS>, ending in nm=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 with set -euo pipefail: if a command fails, it stops there with a non-zero exit, without a line for that connection.
  3. Power the host off.
    sudo systemctl poweroff
    
    Expected: the host shuts down. Leave its power cable in: Wake-on-LAN needs standby power at the NIC.
  4. Send the magic packet from the router.
    /tool/wol mac=<MAC> interface=<BRIDGE>
    
    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.

Verify#

  • After the wake, in a root shell on the host, run ethtool <IF> | grep Wake-on. Expected: Wake-on: g. On my woken hosts Wake-on: g was still set after boot. NetworkManager applies magic on 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:
    $ nmcli -g 802-3-ethernet.wake-on-lan c show "Wired connection 1"
    magic
    
    Expected: magic.

Undo / rollback#

  • In a root shell, set back the values you recorded in Before you start (mine: default and d). 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)CauseFix
The host does not wake from power-off although the BIOS has Wake-on-LAN on; root ethtool <IF> shows Wake-on: dthe connection had 802-3-ethernet.wake-on-lan default, and the NIC was powered down at shutdownsteps 1-2: set magic on the connection
netlink error: Operation not permitted, and no Wake-on lines in the outputethtool run as a normal user: reading Wake-on needs rootrun 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 had magic on the wired connection. ethtool printed netlink error: Operation not permitted and 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 showed Supports Wake-on: pumbg with Wake-on: d, and the wired NetworkManager connection had 802-3-ethernet.wake-on-lan default, so the NIC powered down at shutdown. I ran enable-wol.sh on all four; each printed nm=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=bridge from the MikroTik router at 22:46:21, and they booted at 22:46:40 and 22:46:45. Wake-on: g was 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 upsmon shut 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). The upsmon side is in Run upsmon as a NUT secondary on Fedora and Fedora Atomic.
  • Only g: the NICs also support p, u, m and b (wake on PHY activity, unicast, multicast, broadcast); each of those can wake the host on ordinary traffic. I enabled the magic packet only.
  • default is not "off" by name: per the nmcli settings reference, default means "use global settings", and ignore stops 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 ethtool from PATH and 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#