Enabling remote PC startup and operation with WoL

5 min

language: ja bn en es hi pt ru zh-cn zh-tw

Happy New Year!
It's Munou.

I've decided to leave my home server at my parents' house for now, and I've started to feel that I won't have much trouble even without a high-speed internet contract if I use the network of my home server at my parents' house. So, I want to make my Ryzen machine, which I use as a remote environment (VNC server) for builds and desktop environments, usable.

However, I don't want to keep the machine always on, so I'll enable remote startup.

Remote Configuration Concept

Since the main home server will always be running, I plan to start the Ryzen machine and SSH into it via that server.
So, how do I access that home server? I'll access the home server from within the VPN network via a Vultr VPN server, and use it to start the Ryzen machine and as an SSH client.

  1. SSH from Vultr - FreeBSD server to home server
  2. Start Ryzen machine with WoL from home server
  3. SSH from home server to Ryzen machine

This is the flow.

Ryzen Machine Preparation

Enable Wake on LAN on the Ryzen Machine

Wake on LAN should be off by default.
It allows the machine to start when it receives a specific packet, a magic packet.
Enable it from the Ryzen machine's BIOS screen.
Image

Verify on Ryzen Machine

Use ethtool to check if Wake on LAN is enabled.

sudo pacman -S ethtool
sudo ethtool eth0

It's OK if it shows something like Wake-on: g as below.

alleycat:[hrtaro]:~$ sudo ethtool eth0
[sudo] hrtaro のパスワード:
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 10baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        MDI-X: off (auto)
        Supports Wake-on: pumbg
        Wake-on: g

Then, make a note of this machine's MAC address.

ip link show eth0

Now, shut it down once. Be careful, as without the -h option, it will enter single-user mode, which is a maintenance mode.

sudo shutdown -h now

This concludes the Ryzen machine's setup for now.

Client-side Preparation

Install wake on lan

Since the machine that will initiate the startup is Devuan, I'll search with apt.

$ sudo apt search wakeonlan
Sorting... Done
Full Text Search... Done  
gwakeonlan/stable 0.8.5-1 all
  Tool to wake up machines using Wake on LAN

wakeonlan/stable 0.41-12.1 all
  Sends 'magic packets' to wake-on-LAN enabled Ethernet adapters

Found it! Installation

sudo apt install wakeonlan

Start with wakeonlan

And with this, it can be started.

$ wakeonlan {macAdress}
Sending magic packet to 255.255.255.255:* with {macAdress}

I thought it would be a big task, but it went smoother than expected, and I'm impressed with myself!
After that, once ping starts responding, for example with ping -c 5 {IP of the started machine}, let's SSH. That's all.
I wish you all a wonderful year.

Related Posts