0

I'd like to detect if Wake On Lan is possible.

On my router (Tomato firmware) there is a table with info - when displays device "Active (In ARP)" - it's possible to turn this device by WOL (offline linux pc).

I wonder if it is achieved by router only function or I can do this in C# or C? Function SendArp can detect MAC adress and do "arping" but it is not what I would like to do.

mmatloka
  • 1,986
  • 1
  • 20
  • 46

3 Answers3

1

Your router can't detect if your computer (or any other network device) supports Wake-On-Lan. All your router can do is send out a WOL package and hoping that it will wake up.

If the calling device respects the packet and wakes up must be configured at the device itself and there exists nothing within the OSI layers 4 to 1 which can tell you if a device supports WOL.

If you like to send a WOL packet from your PC using C#, you find plenty examples by using your favourite search engine. Here is one example from Bart de Smet.

Update

The message "Active (In ARP)" doesn't mean that your router detected that it is possible to send a WOL packet. It just tells you that within the routers ARP cache currently is a matching entry for this IP or MAC address. Such a cache has every network device (also your pc). In Windows just open the command line and enter arp -a to see the cache of your windows machine. Here you'll get a list of the stored mac adresses for sending to an IP address. A black hat can try to manipulate this cache to redirect your ip communication. Further informations about this can be found at wikipedia.

So this message just tells you, that your router had recently an ip connection to this device. That's it. But it can't tell you if your device is currently able to handle a WOL packet (cause it is power connected or not).

Oliver
  • 43,366
  • 8
  • 94
  • 151
  • I didn't mean it can detect if computer detects Wake-On-Lan. Computer can be woke up when it was turned on earlier and it was't pluged off from power. Then it is possible to send WOL. When it was pluged off from power outlet it won't react to WOL. Router can detect if it can be woken up at that moment. – mmatloka Nov 10 '10 at 19:17
  • @mich It depends on the NIC, some cards have flash and reload the wol settings even after the power loss. – David Costa Jan 17 '11 at 11:34
0

You're probably best checking out http://msdn.microsoft.com/en-us/library/ff566341(VS.85).aspx

This will let you query boolean for power management and the device specific "wake enabled" state.

Given that it's WMI, you should be able to get to this remotely, but it does need a couple of registry keys set to expose the WMI class.

dotalchemy
  • 2,459
  • 19
  • 24
  • But this way I get info about settings of running windows machine. What I meant is to query if turned off machine can be waked on lan (this do my router). – mmatloka Oct 02 '10 at 22:49
0

You get the info about whether a machine supports WOL from the BIOS.

If it is supported, make sure it's turned on. Many machines have the capability disabled by default.

To route WOL packets through the network you need to forward port 9 on the router to 255.255.255.255 (Brodcast-to-all) IP Address.

Evan Plaice
  • 13,944
  • 6
  • 76
  • 94