Getting Wake On Lan (WOL) working

Some time ago, I'd experimented with Wake On Lan (WOL) using amber, the most modern PC in the house, as the target. I'd tried a couple of ways; using a python program I'd found in the internet and also the FreeBSD wol port. However, I simply could not get it to work.

The BIOS seemed to be setup correctly. The power supply was quite old, and maybe not up to the WOL specs, so I replaced that. No difference. May be the router I was using (Netgear DG834N) was doing something? I tried a direct connection (using a cross-wired lan cable); still no joy. In the end I gave up trying; more important things to do.

Later, the Netgear router started having wireless problems. It was out of warranty, so time for a replacement, as the backup router from BeThere (the BeBox is a Thompson 585v7) was subject to intermittent cut outs (probably due to overheating, as placing it upside down reduced the incidence).

After a bit of research, I bought a Draytek 2820n. I'd had a Draytek before ((the 2800) which I had replaced as its ability to handle the ADSL2+ line provided by BeThere was non-existent. Reports from existing BeThere users showed that the 2820n, however, worked fine.

While browsing the router's capabilities, I noticed it provided a WOL function. Hmm, would it work? Well, yes it did! Fantastic, so I tried from the FreeBSD server using the wol program. Still didn't work. What was going on?

Maybe wol was broken somehow. Did wake.py do any better?

  [mark@topaz:~] python ~/dev/python/wake.py  00:21:85:5E:A9:D9
  sending magic packet to 255.255.255.255:9 with 00:21:85:5E:A9:D9
  [mark@topaz:~]%  

No, it didn't. However, seeing the above message from wake.py, combined with re-reading the command arguments supported by wol gave me an idea. Here's the key argument description from wol:

  -h HOST
  --host=HOST
  -i HOST
  --ipaddr=HOST
      Broadcast packet to this IP address or hostname. This is important
      if your wol client is a multihomed host and you want to send only
      to one subnet (default IP address is 255.255.255.255).

Maybe I should be sending the packet to the local subnet, i.e. 192.168.0.255, rather than the entire world? So I tried this:

  wol -i 192.168.0.255 00:21:85:5E:A9:D9

Success! amber awakes and Corwin will walk the pattern once more...

I'm not sure why this works; maybe the router firewall quenches global broadcasts to 255.255.255.255? Although that doesn't explain why it didn't work with a direct cross-over cable connection; maybe I should test that again when I have time.