Skip to content

Instantly share code, notes, and snippets.

@Zer0xFF
Last active January 8, 2019 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zer0xFF/bb09d68e432aa7fec5d4364996ce3fb5 to your computer and use it in GitHub Desktop.
Save Zer0xFF/bb09d68e432aa7fec5d4364996ce3fb5 to your computer and use it in GitHub Desktop.
WoL PC using Raspberry Pi (RPI)

I host all my media on my Desktop PC, which is connected to the network via WIFI, unfortunely my Wifi Card doesnt support WoL (as dont most Wifi cards?), so my solution was to use an old RPI Model B with Wifi dongle I have as WoL switch, since

  1. it's low powered, compared to keeping PC on all the time
  2. can be powered by the PC USB port
  3. has a ethernet port which can be connected directly to PC

Requirements:

  1. RPI any model with Ethernet connection and WIFI (for wifi, i used a 5 euro wifi dongle)

Steps:

  1. create WoL.service/.sh as provided
  2. Update the 2 MAC addresses in *.sh
    • AA:BB:CC:DD:EE:FF is the PC's Ethernet MAC Address
    • \x11\x22\x33 is the PC's WIFI MAC Address note: that for WIFI MAC, you could include the entire address, but we only need enough for a valid match
  3. use any WoL app/utility, I downloaded the 1st WoL on the Play store
    • search for your PC WIFI IP/MAC or enter manually
  4. you're done, as long as the RPI is connected to the PC by ethernet and to the net by WIFI
[Unit]
Description=PC WoL
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/home/pi
ExecStart=/home/pi/WoL.service.sh
Restart=always
StartLimitInterval=0
[Install]
WantedBy=multi-user.target
#!/bin/bash
ngrep -d wlan0 '\xff{6}(.{12})\x11\x22\x33' -x port 9 -n 1 && etherwake -i eth0 AA:BB:CC:DD:EE:FF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment