Skip to content
accelerando

Linux: Persistent wake-on-lan

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

NETDOWN=no

to “/etc/default/halt”.

2 Comments

  1. Paul Canavan wrote:

    Very nice. Thanks.

    Posted on 26-Apr-13 at 12:16 pm | Permalink
  2. Michael wrote:

    You’re welcome.

    Posted on 26-Apr-13 at 7:58 pm | Permalink

Post a Comment

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

*