There are two solutions. You can use a free service like freedns.afraid.org, which hosts your DNS (domain name service) for you— a method that works even if you have a dynamic IP address at home. Or you can run your own DNS server— a method that works only if you have at least two static IP addresses at home and requires a rock-solid reliable connnection.
Real Domain Names With freedns.afraid.orgfreedns.afraid.org also offers a free DNS service for "real" domains. freedns.afraid.org allows you to register a "real" domain name (such as example.com) in the usual way and then point hostnames such as www.example.com to your own computers at home, for free.
Of course, you still have to register your domains with a real domain registrar, and that is not free. But the small annual fee to keep your own domain name is not unrealistic for most people.
Once your freedns.afraid.org configuration settings are correct, you will Need to log into your domain name registrar's website and change your DNS server settings to match those provided by freedns.afraid.org. Within 24 hours or so, everyone who looks up your domain name will be correctly referred to your home computer.
freedns.afraid.org provides a good, free solution. But those who are hosting at home for the sake of understanding the technology thoroughly might want to "roll their own" DNS server as well.
Running Your Own DNS ServerMake no mistake, this is the tougher way to go. But if you have at least two static IP addresses at home, assigned directly to the computer you plan to use as a server, you can save a little money and have the satisfaction of hosting one more piece of your Internet presence at home. Of course, you'll also run additional security and reliability risks. You'll need much more expertise. And you may find that two static IP addresses are as expensive as custom DNS service.
"Why do I need a static IP address at home to run a DNS server?"
The purpose of DNS is to allow friendly domain names to be translated to IP addresses. It's the job of a DNS server to do that translation. But first, a user's computer must know the IP address of the DNS server itself!
That information comes from the "root DNS servers." And the root DNS servers obtain it from what's known informally as the "whois database," a central registry of domain names, domain owners, and DNS servers. This is the database you're added to when you register a new domain name.
Here's the kicker: the whois database must contain static IP addresses for your domain's DNS servers. Otherwise, users have no way to look up www.example.com and get your home IP address. And yes, I said servers, not server - you must have at least two DNS server IP addresses in the whois database. One is the primary DNS server, and the other is the secondary, consulted if the primary isn't available.
"Can I do this with a server behind a connection-sharing router?"
Yes, but you must use the "virtual server" or "firewall" features of your router to forward all traffic on port 53, for both the TCP and UDP protocols, to your server computer. Your server computer must have a static local IP address configured in order to do this. See how do I give my computer a static local IP address? and how do I set up my router to forward ports from the Internet to my computer?
OK, so you've decided to go for it. How can you set up a DNS server at home?
The good news is that Microsoft has a professional-quality, user-friendly DNS server for its operating systems. The bad news is that it is only included in Microsoft's "server" operating systems, such as Windows 2000 and 2003 Server operating systems. So Windows XP users can't use it. But those who do have a Microsoft server OS should consult the excellent article Installing DNS On Windows 2003 at WindowsNetworking.Com.
For everyone else, including Windows XP, MacOS X and Linux users, the most common answer is BIND. BIND (Berkeley Internet Name Daemon) has been the standard DNS server for Unix operating systems - including Linux and MacOS X - for many years. BIND is reliable and advice is readily available from other BIND users. However, BIND does have a dodgy reputation for reliability when running on Windows. You may find that the latest releases of BIND for Windows are an improvement in this area.
Configuring BIND As Your DNS Server
How do you download, instlal and configure BIND for Windows? The article Installing & Configuring Bind 9 on Windows 2000 covers everything Windows users need to know. Just keep in mind that even though the article says it is for Windows 2000, the same techniques work on Windows XP and other recent versions of Windows.
Configuring BIND For Linux
BIND itself is standard with every major Linux distribution. The real question is how to configure it. Every Linux distribution includes its own somewhat-friendly tools for configuration. But I strongly encourage the use of Webmin, a free, user-friendly web-based interface for configuring many different aspects of a Linux (or other Unix) system. Webmin can easily configure BIND, along with many other things, and the interface doesn't change from one Linux distribution to the next.
Configuring BIND For MacOS X
MacOS X now includes BIND "out of the box." Of course, that doesn't mean it's easy to configure. Fortunately, the article Implementing BIND on Mac OS X at MacDevCenter.Com covers the ins and outs in detail.
An Easier Way For Windows XP UsersThe best choice for Windows XP users is probably Simple DNS Plus, a user-friendly and reliable DNS server program for Windows XP (disclaimer: I am an affiliate). Simple DNS Plus makes it straightforward to assign IP addresses to names in your domain, both for address records (as you'll use for your website) and "MX records," which point to email servers. The only drawback is the price; Simple DNS Plus costs $79. Depending on your skill level, and the amount of time you have to wrestle with BIND, you may find that to be quite worthwhile.
What About Email?
OK, you've set up a DNS server at home. Great! But now that you're running both DNS for a "real" domain and, presumably, a web server at home, you're going to want to receive email intended for that domain. And there's no hosting company out there receiving it for you. So how can you receive it directly?
By running an email server at home, of course... but you probably don't want to do that.
The reason is that spam (unsolicited email) has reached truly epic levels. And all that spam traveling over your cable modem or DSL connection is likely to make your home connection unpleasant to use.
Also, unless you have a business-class DSL or cable modem connection, it is likely that your ISP will "throttle" the email traffic out of concern that you might be the one transmitting the spam.
Finally, there is no reliable email server software available for Windows XP. There are "free SMTP server" programs out there, but these are just one-way outgoing mail utilities, not suitable for handling incoming mail.
If you really want to host your own mail server at home, I recommend running Postfix on a Linux system. Again, you can easily set this up using Webmin.
A better idea, though, is to make arrangements with a hosting company like OLM (to take just one example) that offers email hosting services. Then add an "MX record" (Mail eXchanger record) to your home DNS server, pointing to the address they tell you to use. Because they are hosting your email only, and not your DNS or website, you can pay as little as $20/year for this privilege - and most hosts will filter spam and email viruses for you as part of the service.
Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!