brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wakeonlan: true in netplan, with the interface matched by MAC address

Netplan
~/tips/tip-netplan-wakeonlan-match-mac

wakeonlan: true

Switches Wake on LAN on for an interface, which the docs say to match by MAC.

A machine that sleeps until you need it saves power, and Wake on LAN is the old answer. Netplan can set the flag for you, so it survives a reboot and lives in the same file as the rest of the network config.

network:
  version: 2
  ethernets:
    lan0:
      match:
        macaddress: "00:11:22:33:44:55"
      set-name: lan0
      dhcp4: true
      wakeonlan: true

The wakeonlan key is a boolean and it is off by default. The reference says that with networkd you should match the device by MAC address to get reliable results, which is why the example uses match with macaddress. Put the real MAC of your network card in there, ip link shows it.

Then apply the file with sudo netplan apply, or try it first with sudo netplan try if you are connected over SSH.

The caveat: netplan only sets the option. The network card and the firmware settings still have to support waking up from the network, so if the machine ignores the magic packet, look there next.

The reference says macaddress is the 6-byte permanent MAC address in the form XX:XX:XX:XX:XX:XX and that globs are not allowed. It also doesn’t match virtual MAC addresses, such as those of bridges, bonds or VLANs. All properties you list under match have to match, so a physical card is the intended target.

Further reading: Netplan YAML reference

More Netplan tips – to: 192.168.3.0/24 hidden: true lacp-rate: fast link-local: [] ls -l /etc/netplan/ All Netplan tips (21) All topics

Link