Setting up dynamic DNS
You’re on the road, it’s the night before your big presentation, and after a long day of travel you fire up your Mac to do a last-minute check on your slides. That’s when you realize that you forgot to bring them with you—that the presentation your business’s future depends on is sitting on your Mac at home, hundreds of miles away.
With a little forethought and preparation, this wouldn’t be a problem. You’d just log in to your home computer and retrieve the file via FTP. But you can’t log in to a remote computer if you don’t have its Internet Protocol (IP) address. And if you’re like most of us, your Internet service provider assigns your computer a dynamic IP address that changes all the time. Fortunately, there is a workaround, using an Internet technology called dynamic DNS.
What is dynamic DNS?
DNS, or Domain Name System, translates addresses like
www.macworld.com into numeric IP addresses that Net routers can understand. When you type
www.macworld.com in your Web browser, your Mac asks your ISP’s DNS servers for the corresponding IP address, which it then uses to take you to the Web site you want.
Trouble is, if it's your own computer you're trying to reach, that IP address changes all the time (unless you've arranged for a static IP address). Dynamic DNS providers get around that problem by assigning your computer a plain-English name that stays the same even when your IP address changes. To connect to your home Mac, you just have to remember that name.
Several companies offer dynamic DNS services. (See this comprehensive list.) For this column, I’ll use DynDNS as an example, but the instructions are similar for other providers.
The first thing you need to do is set up an account. With DynDNS, that means going to www.dyndns.com and clicking on Create Account to get started with a free account. Once you’ve created an account, log in with your new user name and password, click on My Services, and then click on Add Hostname to the right of the Host Services list in the middle.
Now it’s time to select your Mac’s plain-English Net address. That address has two parts: The left-most part, which comes before a period preceding the domain name (the
dmoren.dyndns.org), is called the host name. That can be anything you want, as long as someone else hasn’t registered it already. Fill in the name you want and then open the drop-down menu next to the host-name field.
This menu is where you choose the second part of your address, the domain name, which is everything after the first period. Dynamic DNS offers an extensive list of domain names, ranging from the bland (
dyndns.org) to the quirky (
boldlygoingnowhere.org) to the oddly specific (
is-a-chef.net). Your choice here is largely a matter of taste (unless you’re going to be hosting a business Web site on your home Mac, in which case it’s also a question of marketing); the important thing is to choose a name you’ll remember.
The next field down, IP Address, needs to be filled in with your current IP address. Click the Your Current Location’s value to enter, or enter an address manually; a software daemon will update this later, anyway.
Those are the only fields you need to worry about, so once they’re complete, click on Add to Cart at the bottom of the page, even though the service is free for up to five host names. The display will show $0.00 for cost. Click Next, and then on the following page, click Active Services.
Enabling the daemon
At this point, your home Mac has a nice, easy-to-read Net address. But that address will last only as long as your current IP address, which could change at any moment. DynDNS provides software that runs on your home Mac and continuously keeps the DynDNS database abreast of those changes, so your new Net name will always point to your Mac.
To install that software, visit the DynDNS clients page in the DynDNS navigation bar. The Download Now link box in the upper right corner will let you retrieve software for the platform your browser claims it’s using, or you can scroll down for additional links.
Once you’ve downloaded the disk image and dragged the program into your Applications folder, launch DynDNS Updater. You’re be asked for an administrator password so you can install the client’s daemon. This is a small program that runs in the background and keeps the DynDNS servers up-to-date with your IP address.
When the daemon is installed, you’re presented with a dialog box into which to add your account information. Enter the DynDNS user name and password you used to create an account at the Web site. This creates an entry in the list at left; you can add more accounts if you have multiple ones by clicking the + sign.
Click on the triangle next to your user name to show the host names associated with that account. In turn, select each host name, and check Enable Updating for This Host. When the indicator next to the name turns to a green ball, you can proceed. Quit the program when all your names are configured; the software daemon continues to run in the background.
For a quick view of settings, and the ability to change them, select Tools > Install Dashboard Widget.
Putting dynamic DNS to use
So now you have a dynamic DNS host name. But how do you use it? Let’s get back to our nightmare scenario. Before you left on your business trip, you had the foresight to configure your home Mac for just such an emergency. You enabled file sharing on your home computer by going to the Sharing preference pane and enabling File Sharing. You also selected the Remote Login option, so you can use Secure FTP (SFTP) to transfer files.
From your hotel room, you fire up your favorite SFTP client. (Or if you prefer Terminal, you can use OS X’s built-in command-line client). No matter which client you use, enter your dynamic DNS address and the short user name and password for your OS X user account when the client asks for a server. The folders and files in your Home directory should appear.
But dynamic DNS is hardly a one-trick pony. You can also use it to set up a simple Web site on your Mac: Go back to the Sharing preference pane and enable Web Sharing. Then create your site in Apple’s iWeb. When you’re done, choose the Publish To A Folder option and save the files in the Sites folder of your Home directory. Your new page’s address will be your dynamic DNS address followed by a tilde (~) and your OS X short user name:
Now for the provisos: Some ISPs don’t like customers running servers on their home computers, so make sure to check your terms of service. More seriously, you may be concerned about the security of enabling remote access to your Mac—and rightly so. If you’re using a third-party firewall, make sure that it’s leaving the requisite ports open.
You also need to make sure your Mac is awake when you try to access it. To do that, go to the Energy Saver preference pane and set the Computer Sleep to Never, or check Wake for Network Access (see “Wake on Demand lets Snow Leopard sleep with one eye open”).
Dan Moren is a freelance writer and a contributor to MacUser . .
Editor's note: Updated 7/12/10 to reflect changes in Dynamic DNS's site and software.