Wake-on-LAN over internet is all but impossible

2

I have a new MacBook Pro that I want to be able to log into through ssh or vnc, but no matter what combination of things I try nothing seems to work. Even tried LogMeIn

How do I set-up my MacBook so that I can remote into it, even if it's asleep

JoeCortopassi

Posted 2011-01-04T04:53:07.027

Reputation: 283

2There's supposed to be ways to set up your router to forward the magic packet. I just can't get it to work – JoeCortopassi – 2011-01-04T05:05:24.230

1The internet is not a LAN. – Dave Sherohman – 2011-01-04T10:01:57.497

Answers

9

You can't forward the magic packet. It works on Layer 2 of the OSI model and is addressed to the MAC address (ethernet ID) of the target computer, which knows nothing about Layer 3 (IP, i.e. The Internet). This is why it's called Wake-on-LAN.

What you can do is install software on your router that can send a magic packet for you to the machine in question after you log into the router. I do this with a WRT54GL running the Tomato Firmware. I'm sure it could also be accomplished with DD-WRT.

To answer the rest of your question, most people using remote login software just don't bother with sleep in the first place. But regardless, I routinely use OS X's built-in Screen Sharing, which is basically VNC with enhanced authentication. Others commonly use 3rd party VNC clients and servers, like Vine server (Or, they just open up the Screen Sharing/Remote Desktop server to less secure VNC connections). These all require that the appropriate ports be forwarded from your router.

A more user-friendly approach is the 3rd party TeamViewer, which is fairly polished, free for personal use, and doesn't require port forwarding since the "server" computer actually logs into one of TeamViewer's servers from behind your network to wait for a "client" connection.

NReilingh

Posted 2011-01-04T04:53:07.027

Reputation: 5 539

1

You can forward the magic packet, since the protocol doesn't matter - it might as well be standard UDP on a random port. The only requirement is that the packet's contents have the target computer's address. (Sources: original research; Wikipedia.)

– user1686 – 2011-01-04T13:46:46.013

@grawity Can you show me a proof-of-concept? Keep in mind that when a machine goes to sleep, its ethernet interface isn't even necessarily active on the network layer. You'd need custom router firmware that was designed specifically to look for this custom IP-encapsulated magic packet, strip the encapsulation, and then forward it on the subnet's data link layer. Frankly, I think it's much more efficient and simple to use perpetual subnetwork resources (like the router firmware I described, or always-on computers that are visible to the Internet) to just do this normally. – NReilingh – 2011-01-04T13:59:52.563

@grawity Ah, I see your reference; Subnet Directed Broadcasts, indeed. I question whether that technology is practical on consumer routers (since you essentially need to port forward to everything in the subnet mask). Discussions of DD-WRT aren't indicative of much success. – NReilingh – 2011-01-04T14:11:03.000

http://wakeonlan.me/ – John T – 2011-07-15T14:29:59.940

1This is a good answer except for the first paragraph. What makes the magic packet magic is not its headers but its contents. Absolutely any packet containing the magic pattern (something like 0xFFFFFFFFFFFF followed by 16 copies of the target MAC address, if I recall correctly) will wake the machine. Fit that pattern into any routable packet, and you can remotely wake a machine with it. Of course you must know the target's MAC address ahead of time, and that subnet's router must have an unexpired ARP mapping for that client (if the routable packet is IPv4). – Spiff – 2012-02-11T18:29:31.097

5

If you have a TimeCapsule then you can do this in theory. When a Mac goes to sleep it sends a message to a "Sleep Proxy" advertising what services it can offer it is woken up. The Time Capsule then takes care of waking the MacBook, even over wireless.

See: http://support.apple.com/kb/HT3774 which also says this works for Back To My Mac.

John Carr

Posted 2011-01-04T04:53:07.027

Reputation: 176

5

I have gotten it to work:

  1. My router forwards UDP port 9 to the machine that should wake up
  2. The machine has WOL activated, and is connected to the router using ethernet.
  3. I use http://www.dslreports.com/wakeup to wake up the machine (by specifying my WAN IP and the MAC-address of the machine)

After a couple of seconds, the machine is up, and I can eg. log in using SSH.

I have a Zyxel P-2602HW-D1A router and a Macbook running OS X 10.7 (Lion).

I have yet to find a command line tool for Mac/Unix that can do WOL over the internet (ie. specifying both MAC address and IP), but there is a tool for Windows here: http://www.matcode.com/wol.htm

Grav

Posted 2011-01-04T04:53:07.027

Reputation: 151

netcat will do and is available for many different platforms like Linux, Windows, Mac OS, HP-UX, Haiku, Amiga, Android, iOS, FreeDOS. Just requires custom configuration file. What makes it work is that you can wrap anything in TCP/IP packet with netcat, WOL data for example. However if you happen to have ReactOS then it might not work yet. – Sampo Sarrala - codidact.org – 2013-04-24T19:36:30.153

2

Why not just forward a port on the router that you probably have? In this setup, your router would have the static external IP (or use some dynamic DNS service), the router would forward any traffic to one of its ports to your server (which should have a static IP inside your LAN) or it could forward it to a broadcast address of your LAN.

Now sending the the WOL package to your routers IP & the specific forwarded port should start your server (because inside the WOL package there's the MAC of your server).

Port forwarding is pretty common feature in routers, so there should be no need for fancy firmware hacks/WOL capable routers.

These seeem to support my idea:

karniemi

Posted 2011-01-04T04:53:07.027

Reputation: 21

0

For those running Tomato by Shibby, other Tomato based, or OpenWRT firmware on their router, you could write a little script to automatically wake up any PC on your local network that receives a new connection on its SSH port. I've written about this on my blog and the code is on github gist.

Mansour

Posted 2011-01-04T04:53:07.027

Reputation: 181