I decided I wanted a solution to wake my media server automatically when accessed that wasn't dependent on dd-wrt.
I have a raspberry pi so I used it because it is low power and I don't mind keeping it on all the time, of course it could be run from any linux machine.
The final solution I found for myself was writing a little bash script. The raspberry-pi dependencies are etherwake and tcpdump. Both are not installed by default on rasbian. Also on the server Wake On Lan needs to be enabled as mentioned in the other posts.
sudo apt-get install etherwake
sudo apt-get install tcpdump
The wake script is as follows:
nano ~/wol.sh
Then:
#!/bin/bash
pingInterval=60 #time interval, in seconds, between checks that the server is still awake.
target=192.168.x.x #WOL target ip address
targetMAC=00:11:22:33:44:55 #WOL target MAC
wake () {
tcpdump -i eth0 -c 1 -p host $target
etherwake $targetMAC
#echo WOL sent to $target at $targetMAC
return
}
while sleep $pingInterval; do
varPing=`ping -s 1 -c 2 $target > /dev/null; echo $?`
if [ $varPing -eq 0 ]; then
#echo ping success
else
#echo ping fail
wake
fi
done
The primary idea is that it is run from my raspberry-pi which will wake the server if it notices a single arp request for the server. If the server is awake then it wont be listening for an arp request but send a few pings every now and then to make sure it is still awake.
I named the file wol.sh and made it executable. Then put it in the sudo crontab to launch @reboot as root. This is for tcpdump which needs elevated access to listen to eth0 and etherwake.
sudo chmod +x /home/pi/wol.sh
sudo crontab -e
add this to the bottom
@reboot sh /home/pi/wol.sh > /dev/null