Ubuntu – How to enable Wake On Lan (WOL) in Ubuntu 16.04


How to enable Wake On Lan (WOL) in Ubuntu 16.04 LTS?

Best Answer

I've found a better way that worked for me. At least a cleaner way. Apparently Ubuntu changed upstart for systemd, in Ubuntu 15.04, Ubuntu 16.04 and presumably next versions too. I'm new to both systems but this worked for me.

I'm posting this because while googling Ubuntu 16 wol and other similar searches I came across with this post several times. This could help somebody else.

To keep WOL working, I had to re-enable it every time the system booted. To avoid doing this manually I used systemd for this purpose. This is what I did:

  1. First, create the file /etc/systemd/system/wol@.service (keep the @ symbol). Put this in it:

    Description=Wake-on-LAN for %i
    ExecStart=/sbin/ethtool -s %i wol g
  2. Enable this for the interface on boot, run the following command (change eth3 with your interface):

    systemctl enable wol@eth3

    You should see something like this:

    Created symlink from /etc/systemd/system/multi-user.target.wants/wol@eth3.service to /etc/systemd/system/wol@.service.
  3. To check if it's enabled, run the following command (change eth3 with your interface) and it should return enabled:

    systemctl is-enabled wol@eth3
  4. To test this, reboot and run (change eth3 with your interface):

    ethtool eth3

    You should see a line with the following:

    Wake-on: g


Related Question