The Pragmatic Addict

Wake-on-LAN

This is technology from the old days but still proves to be very handy. Wake-on-LAN is a way to trigger sleeping (or powered off) computer to wake up by sending a “Magic Packet” over ethernet.

There are two parts to setting this up: BIOS & OS configuration of the sleeping machine.

Sleeping machine BIOS

Every bios is different but you are looking for a section titled APM (Advanced Power Management). In there should be a setting to trigger a wake from the ethernet card or from the PCIe interface. Make sure this is turned on.

Sleeping machine OS

This is the most important part. Your OS on every boot needs to set the WoL flag on your ethernet card.

Install ethtool:

apt-get install ethtool

Check your WoL flag:

ethtool eth0 | grep Wake-on

You are looking for ‘g’ support which allows for the Magic Packet.

Set the WoL flag

ethtool -s eth0 wol g

To set the WoL flag on each reboot add the above command to the bottom of your /etc/rc.local file. Be sure to check after reboot!

Be sure to take note of your MAC address of your ethernet card:

ifconfig eth0 | grep ether

Waking Computer

There are two different programs available to send the magic packet: etherwake & wakeonlan. I prefer etherwake because it allows you to specify the interface to send the magic packet on:

apt-get install etherwake

I like to put it in a script file for easy access:

#!/bin/bash
etherwake -D -i eth1 10:7c:61:73:47:cf

Created: 2024-05-23 Modified: 2024-06-04