1. Overview: Why is it Necessary?

Keeping a desktop turned on 24/7 at home or in the office can lead to high power consumption and maintenance costs.

Thus, I considered using a small server like Raspberry Pi that runs 24/7 to remotely power on the target desktop only when needed.

To achieve this, I established the following strategy using the "Wake-on-LAN (WOL)" feature:

  • Desktop BIOS Settings: Enable WOL feature
  • Linux (Ubuntu) Settings: Keep the network card active even after system shutdown
  • Raspberry Pi Settings: Create and automate a magic packet sending script

Required packages: - wakeonlan (for sending magic packets from Raspberry Pi or server)

Wake-on-LAN Overview


2. Configuration Environment

  • Target PC: Desktop with Ubuntu 24.04 installed
  • Server: Raspberry Pi 5 (Ubuntu Server 24.04)
  • Network: Connected to the same local network (wired connection recommended)

3. Desktop BIOS Settings

To use Wake-on-LAN, the BIOS settings of the motherboard are very important.

How to Configure BIOS

Set the following items in the BIOS. I used a GIGABYTE motherboard, and other brands can refer to similar options to configure their settings.

  1. Enter the BIOS/UEFI Setup on desktop boot (usually DEL, F2 key)
  2. Activate the following items:

ERP (related to power-saving mode)
- ERP setting: Disabled (if enabled, may block WOL feature).

Enable CSM - CSM Support: Enabled - After enabling CSM, the following items might appear (for GIGABYTE motherboards): - LAN PXE Boot Option ROM: Keep disabled - Storage OpROM Policy: Legacy - Other PCI Devices: Legacy

Resume by LAN / Power On by PCI-E
- Some boards support this feature automatically without any options visible, so it should work fine even if options are not displayed.

  1. Save and reboot

※ The option names may vary slightly by manufacturer, so look for options similar to 'Wake', 'Power On by PCI' to configure.


4. Desktop Linux (Ubuntu) Configuration

In Ubuntu, the NIC (Network Interface Card) must remain active even when the system is off.

1. Check Network Interface Name

ip a

Example result:

2: enp4s0: ...
    link/ether <AA:BB:CC:DD:EE:FF> ...
  • enp4s0: Check the network interface name. (This is the wired LAN device name on the desktop and may vary by device.)
  • AA:BB:CC:DD:EE:FF: MAC address (target for the magic packet) ※ Be cautious with the exposure of MAC addresses for security reasons.

2. Install ethtool

sudo apt update
sudo apt install ethtool

3. Check and Set WOL Status

sudo ethtool enp4s0 | grep Wake

Example output:

Supports Wake-on: pumbg
Wake-on: d
  • d → Disabled state
  • Activate with the following command:
sudo ethtool -s enp4s0 wol g

Check again:

Wake-on: g

4. Set to Automatically Configure at Boot (Optional: Apply if Wake-on:g is reset after reboot)

Since /etc/rc.local is not supported by default after Ubuntu 20.04, using systemd services is preferred.

How to create /etc/rc.local:

sudo nano /etc/rc.local

Add above exit 0:

/sbin/ethtool -s enp4s0 wol g
exit 0

After saving the file, grant execute permissions:

sudo chmod +x /etc/rc.local

You may also need additional configuration for the systemd service.


5. Sending Magic Packet from Raspberry Pi

1. Install wakeonlan package

sudo apt install wakeonlan

2. Execute WOL command

wakeonlan AA:BB:CC:DD:EE:FF # Input the MAC address confirmed earlier.

3. (Optional) Register alias

# Replace AA:BB:CC:DD:EE:FF with the MAC address of the PC for remote booting.
echo "alias wakeup_dude='wakeonlan AA:BB:CC:DD:EE:FF'" >> ~/.bashrc
source ~/.bashrc

→ From now on, you can run it easily like this:

wakeup_dude

6. Results

  • The desktop automatically boots after receiving the magic packet even when completely turned off
  • Successfully completed Wake-on-LAN remote boot implementation!

7. Security Considerations

  • The security settings for the SSH connection of the 'Raspberry Pi' server acting as the control tower, router security settings, UFW settings, etc. must be strengthened.
  • When accessing from outside, it is recommended to use SSH port forwarding or VPN.

8. Usage Example

# Accessing from outside
ssh username@<your_ip_or_domain> -p <your_ssh_port>
# After connection
wakeup_dude
🎉 Desktop automatically boots!

9. Reference

  • Wake-on-LAN only works on wired LAN (not possible with Wi-Fi)
  • Some motherboards might work in the Suspend state but may have limitations in the Shutdown state. (Confirmed success with shutdown on GIGABYTE boards)

By establishing a desktop environment that only "wakes up when needed," smart and efficient server management can be achieved.