When I travel I normally turn off all my network devices at home. However, it sometimes may happen that I need to access one of these devices even when I’m on holiday. So, how can I remotely boot up a network device?
Many servers, desktop computers and other devices with a physical network adapter support the standard ‘Wake on LAN (WOL)’. That means that even when the device is turned off, its network adapter still analyzes the network traffic. If a so called ‘magic packet’ addressed with the MAC address of the network adapter is detected, the device will turn itself on. However, the magic packet needs to be sent from another device that is on the same physical network as well as on the same subnet. More details about ‘Wake on LAN’ can be found on ‘Wikipedia‘.
Without using special network hardware and software protocols it is not possible to use ‘Wake on LAN’ with the following setups:
- WiFi devices
- VPN networks
- Remote networks (WAN)
So, how to overcome these restrictions without investing in special ‘Wake on LAN’ hardware and software? The solution is quite easy. You need a small device with a physical connection to your local network that is permanently running as well as remotely accessible. In my case I can remotely connect to my home network via VPN and I have a permanently turned-on Raspberry Pi that is physically connected to my network.
Hereby the steps to install the required software on your Raspberry Pi, the configuration on the device with the ‘Wake on LAN’ functionality as well as the command to send the ‘magic packet’. The commands have to be entered in a Terminal window. Use your macOS or Linux ‘Terminal’ or a software similar to ‘Putty‘ on Windows.
Step 1: Connect to your Raspberry Pi via SSH
1 2 3 |
ssh pi@<IP address of your Raspberry Pi> e.g. ssh pi@192.168.100.100 <enter password of user pi> |
Step 2: Install ‘etherwake’ on Raspberry Pi
1 |
sudo aptitude install etherwake |
Your Raspberry Pi is now ready to send the ‘magic packet’. You might want to check if the device that will be started with WOL needs any configuration for ‘Wake on LAN’. E.g. I use a Synology NAS that I want to remotely start. On a Synology NAS you need to go to ‘Control panel – Hardware & power – General – Power recovery’ and enable the setting ‘Enable WOL’. Please refer to the manual of your device to learn about the WOL configuration.
To sent the ‘magic packet’ to the MAC address of your device you will also need to know this MAC address. Some devices have their MAC address printed on a sticker that is attached to the device. Otherwise you should find the MAC address in the setting menu of your device. On a Synology NAS you need to go to ‘Control panel – Info Center – Network’.
Now you are ready to send the ‘magic packet’. Again, you will need to establish a SSH connection to your Raspberry Pi with a Terminal application and then initiate the ‘magic packet’ with the target MAC address.
Step 3: Send the ‘magic packet’
1 2 3 4 5 |
ssh pi@<IP address of your Raspberry Pi> e.g. ssh pi@192.168.100.100 <enter password of user pi> sudo etherwake <MAC address of WOL device> e.g. sudo etherwake 00:11:22:33:a4:b5 |
Note that instead of using a SSH connection to your Raspberry Pi you can also establish a graphical ‘VNC session‘ with your Raspberry Pi and enter the commands that start with ‘sudo’ directly in the Terminal window of your Raspberry Pi.