Linux: Persistent wake-on-lan

March 3, 2010 by Michael

Just a quick reminder for myself: You need to enable wake-on-lan on the nic in most linux distributions via ethtool.

If your nic supports WOL, it probably needs to be enabled in your computers BIOS first.

Most WOL tools use the “MagicPacket(tm)” method, so the right command to enable it on the nic “eth0” would be

ethtool -s eth0 wol g

This is not a persistent setting and it is gone after a reboot. Most tips around recommend creating a runlevel script for executing this command after boot or before shutdown.

I’ve added the command as a hook in my network scripts:

auto eth0
iface eth0 inet dhcp
        pre-down ethtool -s eth0 wol g

You can also use post-up. I like this method because i tend to forget about my runlevel scripts and so i keep the network stuff in one place 😉

If you are a debian user, you maybe need to stop your system from turning off the nic on HALT. To do so, add


to “/etc/default/halt”.


  1. Paul Canavan wrote:

    Very nice. Thanks.

    Posted on April 26, 2013 at 12:16 PM | Permalink
  2. Michael wrote:

    You’re welcome.

    Posted on April 26, 2013 at 7:58 PM | Permalink
Post a Comment

Your email is never published nor shared. Required fields are marked *