The problem:

I’m using a 2015 MBP Pro, and I can SSH into a Ubuntu 22.04 desktop computer (with OpenSSH) in the same WiFi LAN.

After I suspend the Ubuntu machine, I want to wake it up from macOS.

The solution:

1. On Ubuntu machine, enable wake-on-wireless-lan (WoWLAN)

iw phy0 wowlan show
# if it shows "WoWLAN is disabled"
sudo iw phy0 wowlan enable magic-packet disconnect
iw phy0 wowlan show
# now it should show WoWLAN is enabled

Also, get the MAC address for later use

ip addr show $(awk 'NR==3{print $1}' /proc/net/wireless | tr -d :) | awk '/ether/{print $2}'

2. On macOS machine, use wakeonlan command to wake up

# if wakeonlan not installed
brew install wakeonlan