Tag Archives: linux wake on lan

Wake on Lan with Linux

Wake on Lan is a great functionality to have if for some reason you have issues accessing the power button of your machine.
Generally, wake on lan works on Linux and Windows with modern machines that support it. Wake on lan also needs a wired connection in order to work.

Here is short guide on how to use wake on lan on Debian based distributions and with Lenovo Ideapad laptop.

Note: On many occasions you will need to also enable wake on lan support on Bios. My Asus desktop (Windows) machine required this. In case of my Lenovo Ideapad, there was no Bios entry at all. However, this Ideapad model still supported wake on lan.

  1. Install ethtool:

    sudo apt install ethtool

    1. Find your lan interface:

    ip a

    For me it was:
    2: enp3s0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    On the very same ip a command you will also locate a MAC address, similar to:

    link/ether 11:a1:11:1c:a1:11

    See if wake on lan is enabled: sudo ethtool enp3s0| grep Wake-on

    When it is enabled you will see something like:

    Supports Wake-on: pumbg
    Wake-on: g

    If you run this command for the very first time, you will more than likely miss the g on Wake-on. To enable wake on lan on the interface(the g letter), execute: ethtool -s enp3s0 wol g

    1. Enable lan interface to support wake on lan on system level during start.

    I did not want to do this every time manually. I created a file called wol.service with the following content:

    ExecStart=ethtool -s enp3s0 wol g

    Then I copied it to right place, enabled it during the system start, and started it on my current session:

    sudo cp wol.service /etc/systemd/system/wol.service
    sudo systemctl enable wol
    sudo systemctl start wol

    4. How to wake on Lan

    I noticed that only systemctl suspend was something that I was able to use and produce a working wake on lan situation. This will likely vary based on your setup.
    In comparison: On Windows hosts, the system needs to be shutdown cleanly and wake on lan will just work.

    On another Debian Linux box you can install: sudo apt install wakeonlan

    Then you can wake the machine with: wakeonlan 11:a1:11:1c:a1:11

    5. Waking with Android or Iphone:

    Wake on lan can also be produced with Android or Iphone. I used Wake On Lan by Mike Webb. You can use that app or something else. I will not directly recommend any applications. I suggest that if you want to use your phone as a wake on lan controller, that you will do some investigation of your own and find out what application is best for your device.