Border
Author: Bruce Grant, Jr. (BX)
Published: February 20, 2008
Installing a DNS Server on Ubuntu 7.10
How I got my web site up Part III: a Guide for Linux Novices
This guide will walk through how install and configure a Bind9 DNS server on a newly installed Ubuntu Linux Server and is meant for the complete Linux novice. The guide assumes readers have a basic knowledge of DNS and networking principles in general. This is the third installment of a series of articles explaining the technologies used to bring this web site online.
Why have your own DNS server? I use mine to allow servers on my network to have internal names that may be accessed inside my firewall. I also use it to specify that www.mydomain.com points at an internal server on my network in the 192.168.0.x range instead of the public IP address provided by my ISP. It also gives me better performance since the DNS server is right here inside my network for resolving names instead of at my ISP. So, if you're convinced then read on.

  1. Installing a Bind9 DNS Server
    1. Install Bind9
      Install bind9 and get any requested dependencies.
    2. Configuring Bind9
      Now for the hard part. The syntax used to specify DNS in Bind9 is a little esoteric. If you're the kind of person who needs to understand every detail then this guide isn't for you.
      1. named.conf.local
        We need to create the named.conf.local file and put the below syntax into it. This file says what domain you are adding names to and what the internal IP address range of that domain will be.

      2. named.conf.options
        Execute the following to edit (or create) the named.conf.options file. This file specifies where bind cache will be and what dns server to use for name requests not found in the rules we're defining for our own domain. For example, a request for www.google.com isn't going to be in our own dns server.

        named.conf.options
        Make sure the forwarders block is uncommented (this includes the closing curly brace following it).
        This is the IP address to forward all requests to not governed by the rules of this DNS server. I set mine to be the IP of my ISPs DNS.
      3. Create your Zones
        To start with make sure you have this directory "/etc/bind/zones" and create it if you don't:
        1. Create Domain Zone File
          The domain zone file defines the rules for the domain you're setting up, in my case it was bxgrant.com. It resolves names to IP addresses for requests that come in for the domain "mydomain.com".
          Create Domain File
          Replace "mydomain.com" with the domain of your web site.

          Contents of Domain Zone File
          Replace "mydomain.com" on this line and all others in the file with your domain (mine was bxgrant).
          Replace "mycomputername" on this line and all others in the file with your computer's name (mine was spongebob).
          Get rid of this line if you don't have a mail server. If you do, replace "smtp" with your mail server's name. My mail server is smtp.bxgrant.com.
          This line and the line beneath it are cname records: aliases for one domain (www.bxgrant.com) to another computer (mycomputername.bxgrant.com). Replace these lines with any aliases you want in your network.
          This line and the two beneath it ar A records: we're specifying that a specific name is associated with a particular IP address - mycomputer.bxgrant.com is located at 192.168.0.x. Make sure you specify every computer and the name/ip address of your network that you want to have.
        2. Create Reverse Domain Zone File
          The reverse domain zone file defines the reverse rules for the domain you're setting up, in my case it was bxgrant.com. It maps IP addresses to names for requests that come in for servers in the domain "mydomain.com". Create/edit the file replcing "0.168.192" with whatever IP address range you're using internally in your network (192.168.0.x or 10.0.0.x).

          Reverse Domain Zone File
          Again, replace 0.168.192 with the internal address you're using (probably this works unless you're using a 10. network).
          Replace mycomputername.mydomain.com with the name of the server that will be your dns server (for me mydns.bxgrant.com) on this line and on line 13. Replace support.mydomain.com with the server to send support to (I didn't have one so I just used support.bxgrant.com). Whatever. It worked.
          From this line on down list each name that will be in the domain (for me bxgrant) and in the IP address range (for me 192.168.0.x). Each line is listed with a number sequentially starting with 1. The order is not important.
    3. Start/Stop/Restart Bind9
      sysvconfig
      I use "sysvconfig" to manage services so the code below won't work unless you install sysvconfig:

      Then to start/stop/restart your dns server:

YOU ARE DONE!!!
Tags
           
Comments
Be the first to add a comment.
Add a Comment
User:
Anonymous (Login or Create Account or Help)
Border