Home Ubuntu 22.04 WakeOnLan
Post
Cancel

Ubuntu 22.04 WakeOnLan

Wake On Lan…

OS: Ubuntu 22.04 server

Wake on lan has been around for a while, and while server grade hardware will have some sort of server management system, or of course the new pikvm which I have to get my hands on one day, I figure with the rise in fuel costs, lets utilise this wake on lan once and for all.

Obviously, motherboard has to support it, and i’ll describe two methods i’ve used where one method will probably work outside of Ubuntu.

Netplan

Super easy with the yaml file. Edit /etc/netplan/xyz.yaml

1
2
3
4
5
6
7
8
9
10
11
# Let NetworkManager manage all devices on this system
network:
  version: 2
  ethernets:
    enp5s0:
      wakeonlan: true
  bridges:
    br0:
      interfaces:
        - enp5s0
      dhcp4: yes

Basically, just add the wakeonlan boolean to the interface which supports it… which by the way you can check with ethtool, but after adding wakeonlan to netplan…

1
sudo netplan --debug generate

if all goes well..

1
sudo netplan --debug apply

When checking with ethtool, use this command, replace with your interface.

1
sudo ethtool enp5s0

The output we’re looking for is…

1
2
	Supports Wake-on: pumbg
	Wake-on: g

If you see the g, we are winning and it’s active. If it says ‘d’ then it has not worked.

There is this other systemd method i’ve seen which i’ve also tried and tested as well.

Create a systemd service… /etc/systemd/system/wol.service

1
2
3
4
5
6
7
8
9
[Unit]
Description=Enable Wake On Lan

[Service]
Type=oneshot
ExecStart=/usr/sbin/ethtool --change enp5s0 wol g

[Install]
WantedBy=basic.target

Then reload systemd so it sees the wol.service and enable it…

1
sudo systemctl daeom-reload
1
sudo systemctl enable --now wol.service

Fingers crossed, your wakeonlan should be enabled if you have used either of these methods.

Wake on Lan from Device…

OK, with the server/desktop ready for wake-on-lan (wol) packets, on linux lets install wakeonlan.

1
sudo apt install wakeonlan

You’ll need the nic mac address from the server which will be awakened. So on the server…

1
ip a

and look for something like this..

1
2
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 48:e7:da:5c:98:f1 brd ff:ff:ff:ff:ff:ff

Next to link/ether is the mac address.

You can either send using wakeonlan without any args, or copy this to a file on your desktop (awakening device), and use wakeonlan with this file.

1
wakeonlan -f wol.file

Good luck!

This post is licensed under CC BY 4.0 by the author.