Home Server Build part 5 – DNS Basics (Ubuntu School)

Ubuntu LogoOnce the server has been configured one major “infrastructure” task remains – setting up DNS. This is where those clever names you thought up back in [the “prerequisites” stage](http://kdmurray.net/2012/06/23/home-server-build-part-3-os-installation-ubuntu-school/) come into play. Strictly speaking DNS isn’t required for everything else to work properly, but it’s one of those things that makes the overall solution that much more elegant. When you’re connecting to various components in your network it’s so much nicer to refer to them by name rather than simply by IP address.

A key piece of information you’ll want to keep close at hand is the Webmin [BIND module](http://doxfer.webmin.com/Webmin/BINDDNSServer) documentation. This provides an easy-to-understand guide to managing DNS using [BIND](http://en.wikipedia.org/wiki/BIND) and Webmin. It was key to me being able to complete this tutorial.

### Create the Domain’s Master Record

For the purposes of this tutorial I’m only going to cover the basics of setting up a DNS server and staging it with a domain (master zone) and setting up named entries (A records) for the devices on your network. DNS can do much more than these basic tasks, but for a personal home server, this is where you’ll get most of the benefits of DNS.

1. Log in to your Webmin server and open up the BIND server administration page
2. Click on **Create a new Master Zone**
3. Enter the name of your domain in the **Domain Name / Network** field (I’ll be using _Lord of the Rings_ examples for this, so my domain will be **lotr**)
4. Set the **Master Server** field to the full name of the DNS server – **gandalf.lotr**
5. Set the **Email Address** field to be that of the server’s administrator (you!)
6. Take the remaining defaults and click on **Create**

### Configure router to use DNS

This step varies from router to router, but the basic principles are the same in most cases. The devices on your network get most of their configuration information from the router using the [DHCP](http://en.wikipedia.org/wiki/DHCP) protocol. This includes the device’s IP address and the DNS server information. Because router models vary so much, I’m going to provide some high-level guidance on what to configure. You may need to consult your router’s documentation for more details.

#### Set the DNS Server

1. Log into your router’s admin screen, often the URL for this is either or
2. Look for a setting for Network configuration or LAN configuration, this is typically where the DNS server info exists — it may be under an **advanced** tab
3. Make note of the DNS server address(es) that are on the configuration screen
4. If there is only one DNS server slot, enter the **IP address** of your DNS server — **do not use the name**
5. If there is a second (or third) DNS server slot, enter the DNS servers that were on this screen initially in the same order they were in previously

* NOTE: this would also be a good opportunity to bring in a 3rd-party DNS service like [Google](https://developers.google.com/speed/public-dns/) or [OpenDNS](http://www.opendns.com/home-solutions/) if you want to
6. Save the settings

#### Reserve IP Addresses

Another very handy feature of routers these days is that they can **reserve** an IP address for a specific machine. This has the effect of consistently providing the same IP address to each device despite the use of the DHCP protocol which typically assigns the next-available address to devices as they connect to the network. This is particularly important for our DNS scenario as it allows us to reliably map names to addresses when we configure the devices in DNS. Without this reservation process you would need to assign [static IP](http://en.wikipedia.org/wiki/IP_address#Uses_of_static_addressing) addresses to each machine on your network — something which is quite often more trouble than it’s worth.

1. In the router’s admin screen under Network or LAN look for a heading called **DHCP Reservation** or **IP Reservation**
2. Often this is displayed as a table of the devices connected to your router
3. Find the devices you want to create names for and reserve each of them
4. Make note of the IP addresses for each device
5. Save the settings

**NOTE:** If you don’t see a particular device that you want to set up a name for in DNS, you can usually add it manually if you have the device’s MAC address.

**Note 2:** If you have devices with more than one connection to the network (ie ethernet + wifi) each of those connections will show up separately. You will need to reserve different IPs (and provide different DNS names) for each interface.

### Set up DNS entries for home LAN devices

Time to set up the remaining names for the rest of the devices on your network

1. Log in to your Webmin server and open up the BIND server administration page
2. Click on the icon for the domain (zone) you want to edit: **lotr**
3. Click on **Address**
4. Enter the name of the device you want to add, with an extra period at the end – **frodo.lotr.**
5. In the **Address** field, enter the IP Address you made note of for that device
6. Leave everything else set to its default setting
7. Click **Create**
8. On the next screen click on **Apply Changes**
9. Repeat for the rest of your devices: aragorn.lotr, legolas.lotr, gimli.lotr