Boot Arch Linux from your Mac or Android using WOL

Wake-On-LAN (WOL) is the ability to turn on your computer over a LAN or the Internet. This article is a record of making a server with Arch Linux installed bootable from a Macbook Pro or Android smartphone.

Prerequisites

To use WOL, the motherboard and NIC must support WOL, and WOL must be enabled from the BIOS. This setting method differs depending on the motherboard, so look for a setting item with a name reminiscent of WOL, such as PCI Power up, Allow PCI wake up event, Boot from PCI / PCI-E.

Check WoL settings

In addition to the BIOS settings, you also need the settings on Linux. Install ʻethtool` to check your WOL settings.

# pacman -Syu ethtool

Use ʻethtoolto check the WOL settings. WOL is disabled whenWake-on:isd, and WOL is enabled when g` is.

# ethtool enp2s0
Settings for enp2s0:
        ...
        Supports Wake-on: pumbg
        Wake-on: d
        ...

You can change the WOL settings using ʻethtool`.

# ethtool -s enp2s0 wol g
# ethtool enp2s0
Settings for enp2s0:
        ...
        Supports Wake-on: pumbg
        Wake-on: g
        ...

Server settings

Setting WOL with ʻethtool` has no effect on reboot. One of the following settings is required to make the settings persistent.

netctl

/etc/netctl/profile


ExecUpPost='/usr/bin/ethtool -s enp2s0 wol g'

systemctl

/etc/systemd/network/10-enp2s0.link


[Match]
MACAddress=00:00:00:00:00:00

[Link]
Name=enp2s0
WakeOnLan=magic

Client settings

Mac OS X

Install wakeonlan using HomeBrew.

# brew install wakeonlan

Specifying the server's MAC address as an argument to the wakeonlan command sends a magic packet to the Limited Broadcast Address (255.255.255.255). When this magic packet reaches the server, the server powers up.

# wakeonlan 00:00:00:00:00:00

Android

Please install the appropriate Android app. I used Wake On Lan. An example of the setting value is shown below.

Field Value
Broadcast Address 192.168.0.255
Host IP Address 192.168.0.16
Port Number 9
Mac Address 00:00:00:00:00:00

For Broadcast Address, specify either Limited Broadcast Address (255.255.255.255) or Directed Broadcast Address (e.g. 192.168.0.255). I will not touch on the difference between the two here. In most environments, you should specify either one and it will work fine.

For Host IP Address, specify the IP address of the server. Originally, WOL should not need this setting, but depending on the application, it may be necessary to set it to check whether it started successfully.

Port Number is the port number for sending WOL magic packets. Normally, use UDP port 7 (Echo Protocol) or port 9 (Discard Protocol).

Mac Address is the MAC address of the target server.

References

Recommended Posts

Boot Arch Linux from your Mac or Android using WOL
Try using your Android device as an audio receiver for your Linux desktop
Put Anaconda on your Mac using Pyenv
Arch Linux install to BIOS boot system