Skip to content

Instantly share code, notes, and snippets.

@Natetronn
Forked from paddy74/setup_wol.sh
Created October 10, 2022 17:13
Show Gist options
  • Select an option

  • Save Natetronn/95528b099c7feff0c6795391a7bae599 to your computer and use it in GitHub Desktop.

Select an option

Save Natetronn/95528b099c7feff0c6795391a7bae599 to your computer and use it in GitHub Desktop.
Setting up wake-on-lan on Arch
#!/bin/bash
# https://wiki.archlinux.org/index.php/Wake-on-LAN
sudo pacman -Syu ethtool
# d (disabled), p (PHY activity), u (unicast activity), m (multicast activity),
# b (broadcast activity), a (ARP activity), and g (magic packet activity)
ethtool <interface> | grep Wake-on
# If not g
ethtool -s <interface> wol g
# Enable persistence using systemd
sudo systemd enable wol@.service
# TODO: Require password
# Trigger a wake-up
# Install wol
# TODO: https://www.depicus.com/wake-on-lan/woli
# Find the MAC address
ip link
# In-network
wol target_MAC_address
# or
wol target_internal_IP target_MAC_address
# Across the internet
# Enable port forwarding on target's static IP
wol -p forwarded_port -i router_IP target_MAC_address
[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target
[Service]
ExecStart=/usr/bin/ethtool -s %i wol g
Type=oneshot
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment