Setting up Wake On LAN on Linux

1 minute read

On the machine to wake

Install the “ethtool” package.

sudo apt install -y ethtool

Check the network interface MAC address.

ip a

Check the wake-on-lan state:

sudo ethtool eth0 | grep Wake-on

Sample Output:

debian@debian:~$ sudo ethtool eth0 | grep Wake-on
[sudo] password for debian: 
	Supports Wake-on: pumbg
	Wake-on: d
debian@debian:~$ 

The “d” state means “disabled”. So, enable it.

sudo ethtool -s eth0 wol g

Now, it’s enabled. Now we gotta make it persist throghout reboots and shutdowns.

sudo crontab -e

# Add the following line at the end and save it.

@reboot /usr/sbin/ethtool -s eth0 wol g

 

On the main machine from where it will send the wake-on-lan signal aka magick packet

Install the “wakeonlan” package.

sudo pacman -S wakeonlan

You’re done!

Syntax:
wakeonlan [MAC_OF_SERVER]

Example:
wakeonlan 76:f9:27:1c:65:43