The most important step in bringing an Internet server online is making sure it can be found from the outside world.
Mac OS X, in addition to being a fabulous desktop machine, also has a full-fledged Unix server humming away beneath the hood. You can serve up web pages [Hack #88], send mail through your own sendmail [Hack #82] server, retrieve mail using IMAP or POP [Hack #82], and so much more.
Of course, bringing a server (particularly a web server) online isn't all that helpful unless you make sure it can be found and reached from the outside world.
Whether you are on a local intranet or on the Internet, an IP address is how people locate your computer. I'm not going to go into a lot of detail here, but when you register a domain name, you are required to point that domain to a name server, and that name server has an IP address.
The problem is that most DSL/cable companies give you a fat connection, but they don't include a static (nonchanging) IP address. They usually assign you a dynamic IP address that might change hourly, daily, or whatever. The problem is that you can't point to a domain name or locate your computer on the Internet if the IP address is always changing. It's like having your computer in the witness relocation program. Luckily, there is a solution.
Your first option is getting a static IP address from your DSL/cable provider. My DSL provider wants to charge me an additional $10 per month for that service, but I'm trying to cut down my costs, not increase them.
Traffic on the Internet is simply routed from one IP address to another. No one can remember to type 22.214.171.124 when they want something like Yahoo!, so someone created a way of locating machines called Domain Name Service (DNS). When you type in www.oreillynet.com, DNS servers are able to resolve the proper IP address associated with it and take you to that location.
A number of organizations and companies provide what are called dynamic DNS services; for a fee, they will give you a DNS hostname. They do not redirect traffic to your IP address (which would involve traffic passing through their servers), but instead they point the computer requesting the domain name/DNS hostname of the correct IP location. Using a service like this ensures that whenever there is a request for your domain, it will always know where to point visitors.
If your dynamic address at home is always changing, how do they know what your current address is? Simple: you use a client application on your computer that pings your current local IP address, detects whether there has been a change, and updates the dynamic DNS service's database (see Figure 6-46). So, if my current IP changes from 126.96.36.199 to 188.8.131.52, the program takes that second number and sends the update to the dynamic DNS service. Easy as pie!
I use a service called DynDNS (http://www.dyndns.org). You can find a pretty good FAQ on this service at http://support.dyndns.org/dyndns/faq.php. If you use the service, you should support it by making a small contribution each year. The client I use is a carbonized freeware application called Mac Dynamic DNS, written by James Sentman. It has a number of features that allow for some pretty advanced scheduling and logging. It ain't pretty, but it does the job reliably. You can find the application on the DynDNS site.
Now, I want to point out that you don't have to register your own domain name to use this service. DynDNS has a number of existing domains that you can use. For example, you could create a domain name similar to yourusername.homeunix.com. This saves you the nominal cost of setting up a domain name and still gives you the ability to point people to your computer.
Go ahead and set up an account and make the donation. It may take up to 48 hours for confirmation from the donations department that your donation was received, so be patient.
Go to the Network Preferences pane and make sure your network connection is set to DHCP so that your ISP will assign you an IP address properly.
Now, if you've made your donation and followed the DynDNS instructions to create your account, you need to add this account information to the Mac Dynamic DNS application. It has an easy-to-follow wizard that will walk you through creating the client account (see Figure 6-47). Set this as your master account, turn the account on, and click Check Now to update your IP address with the DynDNS service. When it has communicated with the service, it will show your current IP address in the window. Don't forget to set the application's preferences to update the address automatically!
The agraham999 account is on, displays my IP, and shows the last time it was checked. Hopefully, your IP address will look different. You can click Check Now to have it override the schedule.
Because I don't know how often my DSL provider updates my IP, I've set the Dynamic DNS application to check my connection every 15 minutes and notify DynDNS.org of any changes.