WOL - Wake On Lan over internet

3

7

My problem has become pretty specific but probably pretty easy to solve. I've followed numerous guides on the internet to setup wake on lan and managed to get it working quite good although I still have one issue.

I can wake up my computer via LAN and even over 3G, but when I'm sending over 3G I can only send about a minute or two after I shut down the computer (might be longer), but if it takes much longer my computer won't boot.

The guides mentioned something about the router forgetting my MAC address after some time, but if that is the problem, should it work over a private network?, and how do I resolve this issue?

I've installed DD-WRT on my DIR-615 router. The computer I want to wake up is running Windows 7 Ultimate.

Joakim Engstrom

Posted 2011-04-03T09:15:29.200

Reputation: 159

On a private network it doesn't matter if the router remembers your MAC address as it will just forward it out to all ports on the network. – Matthew Steeples – 2011-04-03T09:43:22.977

Answers

7

WoL works by sending a specially formatted ethernet packet to the MAC address of your computer. If you are on the local network (the LAN) you can communicate direct with your computer's MAC address and WoL works all the time quite happily.

From anywhere outside the local network you rely on IP routing to forward IP encapsulated packets through the network to get to your computer. This forwarding relies on ARP (Address Resolution Protocol) at the final hop (your router to your computer).

Your router keeps a record of which IP addresses are mapped to which MAC addresses - the ARP table - which periodically has stale entries purged.

Under normal network operation the router first sends an ARP WHOHAS packet to all the computers on the network (MAC address ff:ff:ff:ff:ff:ff) requesting the computer that has the IP address specified in the packet to respond with an ARP HAS packet stating that it has the IP address in question. This gets cached in the ARP table for a period of time.

If the computer is switched (or asleep) the network stack can no longer respond with anything, so the ARP WHOHAS request never succeeds - so the router cannot work out where to send the packet to - hence WoL then fails.

There are 2 possible ways around this problem:

  • Set up a static ARP entry on the router

This is by far the simplest if the router has the ability to store a MAC->IP mapping permanantly. This will remove the need for ARP to try and discover the MAC address of your computer.

  • Have another network device on the local network that never sleeps and is able to perform the WoL for you.

Seems to defeat the object really, but it may be the only way to do remote-WoL.

Majenko

Posted 2011-04-03T09:15:29.200

Reputation: 29 007

"Note that this will send the WoL packet to all computers on the network - waking them all up." That's not how this works at all. Computers only respond to the Magic Packet that matches their own MAC address. It's ignored by all the other NICs that receive it. "The magic packet contains the MAC address of the destination computer, an identifying number built into each network interface card ("NIC") or other Ethernet device in a computer, that enables it to be uniquely recognized and addressed on a network." https://en.wikipedia.org/wiki/Wake-on-LAN – Mr Ethernet – 2019-12-16T03:30:41.407

Thanks for the really great answer and I got some really good information on how this all works, and after reading the DD-WRT wiki on WOL it actually says to add static ARP:s to the router, it suggest writing in these commands into the router: – Joakim Engstrom – 2011-04-04T06:57:59.047

ip neigh change 192.168.1.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br0

ip neigh add 192.168.1.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br0

I'm guessing that the IP that is chosen is random and does not matters long as it not assigned to anything? But I'm still a little unsure of what mac-adress I should write instead of ff.ff...

The wiki post can be found here: http://www.dd-wrt.com/wiki/index.php/WOL

– Joakim Engstrom – 2011-04-04T07:07:15.170

It must be stressed that the MAC address to ff:ff:ff:ff:ff:ff (the broadcast address) needs to be used as otherwise the traffic will not get propagated over all switch ports in the network. i.e., use ff:ff:ff:ff:ff:ff so that the switch doesn't care what port the computer is plugged into. Note that this will send the WoL packet to all computers on the network - waking them all up. – Majenko – 2011-04-04T08:00:03.157

Just one more stupid question, when you say "MAC address to ff:ff:ff:ff:ff:ff (the broadcast address)" is that the routers mac-adress, the computer I want to wake up, the device sending the WOL. Or should it simply be ff:ff:ff:ff:ff:ff? for it to send over all the ethernet ports? – Joakim Engstrom – 2011-04-04T10:49:26.250

It should simply be ff:ff:ff:ff:ff:ff – Majenko – 2011-04-04T10:56:48.413