My D-Link router died and I bought a Linksys WRT54g thinking I could put Linux on it. Unfortunately, I should have checked a little more before I bought it because I got a v5, which has half of the RAM and flash memory and is not compatible with most 3rd party firmwares. I also found out that I could not forward packets to the broadcast address, which is exactly what I needed to do to get Wake-on-LAN working.
I use a web based Wake on LAN utility to wake up my computer. Since a computer that isn’t powered on does not have an IP address, it listens for a “magic packet”. A magic packet is data sent over the network to every computer that has the MAC address of the computer you want to turn on. I needed to forward the magic packet to the broadcast address, which on my home LAN was UDP port 9 on 192.168.1.255. However, the Linksys WRT54g will not allow you to forward a port to xxx.xxx.xxx.255, so I needed to find another way. After doing some research, I found out that I could change the subnet from 255.255.255.0 to 255.255.255.128, so the broadcast address would then be xxx.xxx.xxx.127, which could then be forwarded in the Linksys WRT54g.
Next, I needed to turn on Wake on LAN support in Linux. I did an “apt-get install ethtool” and ran “ethtool eth0″ in the console. It read “Wake-on: d”, showing that wake on LAN was disabled. I ran “ethtool -s eth0 wol g” which turned it on. However, it would only work one time and then I would have to run “ethtool -s eth0 wol g” again. I found that if you edit /etc/network/interfaces and add “up ethtool -s eth0 wol g” under “iface eth0″, it would run every time the interface was started.
Thanks to this article for the ethtool info: http://www.debian-administration.org/articles/122
and thanks to this site for the subnet calculator: http://www.subnet-calculator.com/