Wake on LAN
Table of Contents
Wake on LAN#
1. Check if server supports wake-on-lan:#
SSH to server. Im using Proxmox.
ssh username@server
List interfaces and find the interface the correct one.
Usually integraded interfaces, like on a motherboard, will work.
root@home-server ~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
4: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
eno1 seems to be the one we are looking for.
Now we check if WoL is available on the interface.
root@home-server ~# ethtool eno1 | grep "Wake"
Supports Wake-on: pumbg
Wake-on: d
WoL is supported, but at the moment it is disabled (d).
If it was not available for the interface, we should see:
root@home-server ~# ethtool eno1 | grep "Wake"
Supports Wake-on: d
Wake-on: d
2. Enable WoL#
We can simple use ethtool to enable WoL, but if we want to make it persist after a shutdown, we want to add the text below to the end of the file in /etc/network/interfaces:
post-up /usr/sbin/ethtool -s eno1 wol g
3. How to start the server#
From another machine on the network, we can simple use the tool call wakeonlan:
# Linux
sudo apt install wakeonlan
# macOS
brew install wakeonlan
Make sure traffic on port 9 is enabled between machines.
To send the packet, simple use the command below:
wakeonlan xx:xx:xx:xx:xx:xx
xx:xx:xx:xx:xx:xx needs to be replace with the mac-addr from the interface you want to send the magic packet to. In this case it would be the Proxmox servers eno1 interface.
To watch the sending of the packet from the machine you are sending the magic packet from, you can use tcpdump to capture the packet:
sudo tcpdum -nXxei any ether proto 0x0842 or udp port 9 2>/dev/null