Wake on LAN over different subnets

I have 3 IP blocks and 3 Cisco Switches. Each switch has its own IP block - 10.45.100.0/24, 10.45.101.0/24 and 10.45.102.0/24

I have got a PC on 10.45.100.0/24 block. I can wake up whole computers (with IP Address, Mac Address, Subnet, Port) in this IP block from C#.

But when I try to wake up another machine from a different IP block it does not work.

This is a Network Problem or code problem? How can I solve it?


Solution 1:

This is a fundamental problem: WOL only works inside a subnet, because a WOL magic packet isn't a valid IP packet and therefore is not routable beyound the local LAN.

The wikipedia entry outlines a solution for this problem (subnet directed broadcasts), but I've never seen this in action. Another way around the problem might be to create a WOL proxy agent that forwards WOL packets into other subnets (i.e. as a UDP packet).

Solution 2:

If you have three different subnets, those subnets cannot talk to each other without a router.

This is 100% deliberate and by design.

Your Default Gateway from the machine you're trying to do the WOL from must explicity know how to get to those other subnets, or else it sends your packet out onto the internet, where it will be immediately dropped by your ISP.

So, you have two choices:

  1. Set up proper routing between the subnets
  2. Reduce your subnet mask to something like 255.255.0.0 (/16) so that all the machines are on the same subnet. I do not reccomend this, as I'm sure there's a reason that your machines are subnetted off from eachother.

Solution 3:

One possible solution: Add a second(even a third) NIC card to your controlling PC, then configure with the other IP addresses to connect directly with the other routers. Magic packets will then pass out the associated NIC based on destination IP in the WOL command (IP, MAC, subnet, port).

Solution 4:

WOL magic packets are subnet only as you have noticed. You can use Unicast or Subnet-Directed Broadcast depending on what you can enable in your network / router configuration:

https://technet.microsoft.com/en-us/library/bb632911.aspx

Drawbacks to this are that directed broadcasts are commonly unsupported by default due to security and performance concerns. While Unicast is commonly dependant on MAC address table memory kept in router configurations which are purged, usually in about four hours.