You are not logged in.
I want to wake my server at home using wakeonlan. I have it connected to a router with dynDNS service.
I am using the following python code to acheive it:
import socket
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto('\xff'*6+'\x02\x1f\xa3\x46\xbe\xd3'*16, ('my-address.dyndns.info', 9))
If I replace the address with the machine's permanent local IP address, 192.168.1.3, it wakes fine.
I have a service setup on the router to forward port 9 to this machine IP address too, as well as port 22 for ssh access. I can ssh in fine remotely using my-address.dyndns.info, so I know the dyndns system isn't at fault. It doesn't even work if I manually resolve my router's public IP and try this.
Additionally, the router (Netgear) is seeing the broadcast packet, as it gives this in the log:
Wed, 2010-08-04 15:13:43 - UDP Packet - Source:8.19.174.162,37151 Destination:89.117.153.266,9 - [Discard rule match]
Where I've named the router firewall rule that forwards port 9 'Discard'.
Any ideas why it doesn't work remotely?
Offline
I think the L in WoL (Wake on LAN) speaks for itself . I understood it is possible in some circumstances to work around it, but the protocol itself is designed for use on a LAN. If you want it to work on a WAN (here the internet) you need your router to support such a wakeup function - apparently some routers do, but it's not the majority.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
I think the L in WoL (Wake on LAN) speaks for itself . I understood it is possible in some circumstances to work around it, but the protocol itself is designed for use on a LAN. If you want it to work on a WAN (here the internet) you need your router to support such a wakeup function - apparently some routers do, but it's not the majority.
+1
Unfortunately I don't remember how was it called in the router specs - it wasn't WoW for sure
Offline
Hmm, I've done it before...
I think I had to use something called a broadcast address. Try looking at this wikipedia page. It's kinda confusing though: http://en.wikipedia.org/wiki/Broadcast_address
For example: on my router the internal LAN ip addresses are the common 192.168.1.XXX range. The subnet mask is 255.255.255.0. The complement of the subnet mask is 0.0.0.255, so the broadcast address of my LAN is 192.168.1.255.
If I were to set up WOL over internet, I would forward all incoming traffic on port 9 to 192.168.1.255.
Last edited by Odysseus (2010-08-05 03:10:23)
I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.
Offline
Thanks. I hadn't thought about the naming really, just assumed that a packet is a packet and with a little trickery should work from anywhere.
I found a tutorial for doing this with some googling, but it doesn't seem too great. They did mention the broadcast address though, so I'll give it a try since it's been mentioned multiple times now.
Cheers guys.
Offline
Having done this some years ago (back in my days of trying out network fun with windows, [shudders]), I can confirm that the broadcast address is indeed the key.
If the target computer on the LAN is off (and as you're trying to wake it, I assume it is) it basically doesn't have an IP address, which is probably why you router isn't forwarding the packet. In order for it to work, it is necessary to have the router forward that packet to *all* possible IP addresses (i. e. to the entire subnet, as picked out by the broadcast address, which is calculated as Odysseus describes); once this is done then the LAN computer whose NIC has the specified MAC address should then wake up (provided this is set up in the bios).
The problem is that many routers do not support subnet broadcasts, basically for security I think.
Offline
it basically doesn't have an IP address, which is probably why you router isn't forwarding the packet.
But it works fine on the LAN, even with the machine off. That's what confused me --- it doesn't have an IP then either.
If the target computer on the LAN is off
It's a Core2Duo Mac mini, which only seems to like the WOL when asleep, not off. I assume this is some Apple limitation, but its power consumption is much lower when sleeping than on and idle, so I'm happy.
The problem is that many routers do not support subnet broadcasts, basically for security I think.
I've looked into it (I have a Netgear DGND3300), and I believe it doesn't allow you to forward packets to the default broadcast address of 192.168.1.255. However, with at least some Netgear models, it doesn't actually calculate what the broadcast address is, it's just assuming a subnet of 255.255.255.0 (or last octlet zero). Thus, I believe (and will try it out once I'm home), that I can change the subnet's last octlet to 128 say, and use the broadcast address of 192.168.1.127.
Here's hoping!
Offline