WWW FAQs: How do I host a real domain name at home?

2011-02-16: In the article How do I get a hostname for my home computer, I explain how to get a hostname for free, even if you have dynamic DNS. But the free hostnames provided by companies like freedns.afraid.org don't look as professional as a domain name of your own. They're fine if you want a name like dave.is-a-geek.com. But what if you want to host a domain name like www.dave.com at home?

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.org

freedns.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.

Some domain registrars will host the DNS for your purchased domain as a free service as long as you purchased it from them. godaddy is one such registrar. This is useful only if you have a static IP address at home.
To take advantage of dynamic DNS with freedns.afraid.org, you'll need to install one of a considerable number of freely available client programs available on the site after you create an account. The purpose of these programs is to periodically contact freedns.afraid.org and say "hey, my IP address is over here now," at which point the DNS record for your domain is updated to point to your current IP. Otherwise your hostname goes stale as soon as your IP changes. Windows and Mac/Unix client programs are available, as well as firmware for routers (these guys are hardcore).

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 Server

Make 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.
IMPORTANT: some cable modem and DSL ISPs do not allow DNS servers at home. If this is the case, traffic on port 53 will be filtered, and it will not be possible to run your own DNS server. Changing the port number will not help you, because other computers have no way of knowing you are running DNS on a nonstandard port. If this is the case for your ISP, find a better ISP, upgrade to a business-class connection without restrictions, or use the freedns.afraid.org service described above.

"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?

Not sure whether you have a connection-sharing router? If you have more than one computer on the Internet at home, you have a connection-sharing router. If you have a wireless Internet connection (WiFi), you have a connection-sharing router.
"How do I run a DNS server at home?"

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.

Windows 95, 98 and ME just don't have the necessary stability and reliability to run a DNS server.

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 Users

The 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.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!