Wake-on-LAN over internet is all but impossible

7,274

Solution 1

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.

Solution 2

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.

Solution 3

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

Solution 4

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:

Share:
7,274

Related videos on Youtube

JoeCortopassi
Author by

JoeCortopassi

Updated on September 17, 2022

Comments

  • JoeCortopassi
    JoeCortopassi over 1 year

    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
      JoeCortopassi over 13 years
      There's supposed to be ways to set up your router to forward the magic packet. I just can't get it to work
    • Dave Sherohman
      Dave Sherohman over 13 years
      The internet is not a LAN.
  • user1686
    user1686 over 13 years
    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.)
  • NReilingh
    NReilingh over 13 years
    @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
    NReilingh over 13 years
    @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.
  • John T
    John T almost 13 years
  • Sampo Sarrala - codidact.org
    Sampo Sarrala - codidact.org about 11 years
    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.