How to Remotely Wake and Access a Sleeping Mac

Whether at work or traveling, there are times I want to access my home Mac to copy, email or view a file. This can only be successful if your Mac is awake. This post will cover how to remotely wake your Mac from a sleeping state so you can interact with it.

It took me a while to get this working properly, requiring much Googling around, getting frustrated with partial solutions (most of which were out of date) or solutions which were much more complicated than necessary. Although somewhat hardware-specific, I hope the step-by-step below will be useful to a significant Mac audience.

There are basically four components that need to be in place to wake and access a sleeping Mac remotely:

  • Your home Mac needs to be set up to listen for a special network packet. This network packet is called a “Wake on LAN” or WOL packet.
  • Your home router must be configured to allow the WOL packet through to your Mac.
  • You need access to a smartphone or another computer with Internet access. The computer or smartphone you want to use to view the files residing on your home Mac is your likely choice. You’ll use the phone or computer to send the WOL packet.
  • A means of viewing and manipulating the files on your home Mac when your Mac is awake. I assume you’ve already got this, or you wouldn’t need to worry about waking your Mac in the first place. There are a couple mechanisms I use to get to my Mac:
    • “PocketCloud Explore” on my iPhone from Wyse is a great application I use to find, view or email files that are on my home machine. You have to install the accompanying application called “PocketCloud Companion” on your Mac. You then use a GMail address to link the two up. I know there are other tools to do this sort of thing, this is just the application I use.
    • I also use the Mac’s Terminal application to SSH into my home Mac for a variety of things. I’ll create another post later regarding setting this up.

Configure Your Mac for WOL

I’m running Mac OS X 10.7.3 (Lion) on my home machine. My steps are as follows, yours should be very similar:
1. Go to System Preferences
2. Select the “Energy Saver” panel
3. Set the “Wake for network access” option so it is selected

Configure Your Home Router

I have a D-Link DIR-825 router at home, so the screenshots below are from the web access pages for this device. Other makes and models (assuming your router isn’t too old) should offer similar functionality as described below.

The WOL packet will actually be sent to your router, which is then responsible for sending it along to your Mac within your home network (LAN).

1. From a computer that is on your LAN (e.g., the computer on which you eventually want to access files), open your browser and go to the IP address to configure your router. Look at your router documentation if you don’t already know what this is. For my DIR-825, I go to http://192.168.0.1.

2. After logging into your router, locate where you configure virtual servers. This is where you configure what requests (or types of connections) you want to allow coming into your router from the outside world. It also allows you to indicate where you want that traffic to be directed. In this case, you want to tell your router to allow a Wake On LAN to come in from the outside. On the DIR-825, select the “Advanced” tab (“A” in the figure), then “Virtual Server” in the sidebar (“B” in the figure).

3. Add another incoming protocol as follows, highlighted as “C” in the figure:

a. Click on an unused checkbox in the left column

b. From the “Application Name” dropdown menu, select “Wake-On-LAN”

c. Click the “<<” immediately to the left of the “Application Name” dropdown

d. Enter “192.168.0.255” in the “IP Address” field. If you have another brand of router, this IP address should use 255 as the last field of the address (i.e., if you used 111.222.333.1 to get to your router in step 1, you should use 111.222.333.255 in the IP Address field). This is something it took me a long to time to figure out. I was first using the IP address of my home Mac on my LAN (fixed at 192.168.0.109). Maybe I was Googling the wrong thing, but I couldn’t find an explanation of this.

e. The “Private Port” field should be 9. You can use (mostly) what you want in the “Public Port” field, but it’s beyond the scope of this post to discuss why you might use anything other than 9. Make sure the “Protocol” is UDP, “Schedule” is Always, and “Inbound Filter” is Allow All.

4. Click the “Save Settings” button (“D” in the figure) to save your changes back to the router.

Your router is now configured to receive a WOL packet and allow it into your LAN.

Get Ready to Wake It Up

There are a couple pieces of information you still need to gather before you can send the WOL to your Mac: the IP address of your router and the MAC address of your Mac.

1. [Note: This step is temporary, but is necessary to test things out the first time. See the section “IP Addresses Can be Slippery” below or this post for reasons why.] Look up the IP address of your router by going to the “Status” tab in your router configuration (“A” in the figure below), then “Device Info” in the sidebar (“B” in the figure). Write down what it says in your “IP Address” field (“C” in the figure).

2. Look up the MAC address of your Mac. This is needed because part of the WOL packet data includes the MAC address so your router knows which device on your LAN should receive the packet. The MAC address is a unique hardware identifier (it has nothing to do with Apple Macintosh computers).

a. Go to your Mac’s System Preferences

b. Select the “Network” panel

c. Click on the “Advanced…” button in the lower-right

d. Select the “Hardware” tab

e. Write down the “MAC Address” value (twelve alphanumeric characters separated into pairs with colons, e.g., “58:b0:53:56:9d:8c”)

3. Make sure your Mac is awake, and access it using the tool that requires your Mac to be awake (e.g., for me, Wyse’s PocketCloud Explorer or SSH via Terminal). Now, disconnect from your Mac.

4. Put your Mac to sleep. Now attempt to access your Mac again. I assume it won’t work (probably times out), which is why you’re going to all this trouble with WOL in the first place ;-)

Wake It Up!

There are probably many ways to send the magic Wake on LAN packet to your Mac. I use the following two:

  • From my iPhone, I use “iNet Pro” from Banana Glue. This app costs about $6 at the App Store. The free version has the WOL sending capability disabled. They also have a $2 app called “iNet WOL” which I have not used, but presumably should work for the task at hand but not give you all the functionality of iNet Pro. The app allows you to set up WOL information for waking when you’re doing it from within your LAN (“Via local network”) and from the Internet (“Via internet”). For purposes of this discussion, you should only worry about the “Via internet” settings. In another posting I’ll cover a sensible way to handle the local network (because the IP address of your computer can change within your LAN each time you power it up). After setting up for internet waking, selecting Wake on Lan will get you to something like this:

Make sure the globe icon is selected in the lower right so that the wake is sent via the Internet (the other option is used when you’re waking via your local network). Touch the “Wake” button.

Both of the above methods should wake up your Mac from the sleeping state. Now try to access it again using the file access method of choice (again, PocketCloud Explorer or SSH for me). This time, your connection should be successful. WooHoo! :-)

Note: Depending on settings that other apps may have changed, it’s possible your Mac awoke in a “dark wakeup” state (i.e., the monitor did not awaken like it does when you wake via a keyboard press), but it’s still accessible. This is a new feature of OS X, intended as an energy saver for WOL. However, after I installed PocketCloud Companion, the WOL caused monitor and all to awaken.

IP Addresses Can Be Slippery

Even though you were able to access your Mac immediately after setting all this up, most of us have a weak link in all this. My ISP is Comcast, and the IP address of my router occasionally changes (not sure when, but they can do it at their discretion; it will almost certainly change if you shut down your modem and re-power it on). This can present a big hassle if it changes because your WOL needs your router address, but it will be wrong. Clearly, if you’re away from home, you won’t be able to use the steps above because you need to get to your router to find out what its address is. See the “Keeping Your Home Router At An Expected Address” posting with a solution to eliminate this problem.

Oops!?! My Mac is not sleeping…it’s been shut down!

Of course everything thus far in this post only works if your Mac is sleeping; if it’s shut down, well, that can be a bit more of a problem. I haven’t looked into this much, so there may be some decent solutions if your Mac is powered down. I’ll do another posting discussing in more detail the powered-down issue. You can always ask your neighbor to break into your house and turn on your Mac ;-).

About these ads

3 responses to “How to Remotely Wake and Access a Sleeping Mac

  • nilam1allinone

    Thanks for your great information, the contents are quiet interesting.I will be waiting for

    your next post.
    Sleep Apnea Machine Info

  • prasenjit

    Thanks for such a detailed information, this exactly what I was looking for.
    But for me the your upcoming tutorial will be more useful for y stuff, eagerly waiting for the same.

  • Josh

    Regarding step 3.d. for most LANs, an IP address that ends in .255 is called the broadcast IP, and actually means “every computer on the network.” So by sending the inbound WOL packet to the entire network, every listening computer in your LAN will receive wake-up request. Great article, btw.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: