January 19, 2020

Enabling Wake On Lan in Ubuntu Server 18.04 with Netplan

To enable the Wake On Lan feature of my Thinkpad X61 that serves as a low power home server I had to jump through some hoops:

1. Enable Wake On Lan (wol) in the machine BIOS. Also make sure that the boot order of the Network boot is set correctly.

2. Disable Cloud Init by removing the config file '50-cloud-init.yaml' from '/etc/netplan' and creating the file could-init.disable by running

sudo touch /etc/cloud/cloud-init.disabled

3. Configure Netplan to enable wol for the network interfaces with a config file '01-netcfg.yaml' in '/etc/netplan' with the contents:

                macaddress: 00:1d:72:90:b2:17
            dhcp4: true
            wakeonlan: true
    version: 2
    renderer: networkd

You need to replace the device name and mac address with yours, obviously.

4. I have also added the following line to the crontab with 'crontab -e'

@reboot /usr/sbin/netplan apply

4. To disable the auto sleep when the lid is closed I have edited the file '/etc/systemd/logind.conf' and added the entries: