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

  • 2
    There's supposed to be ways to set up your router to forward the magic packet. I just can't get it to work Jan 4, 2011 at 5:05
  • 1
    The internet is not a LAN. Jan 4, 2011 at 10:01

5 Answers 5


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.

  • 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
    Jan 4, 2011 at 13:46
  • @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
    Jan 4, 2011 at 13:59
  • @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
    Jan 4, 2011 at 14:11
  • wakeonlan.me
    – John T
    Jul 15, 2011 at 14:29
  • 1
    This 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
    Feb 11, 2012 at 18:29

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


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.


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:


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.