ELS Howto: DNS Server


Synopsis

This document describes how to set up a forwarding-only Domain Name System (DNS) server on an Elemental Linux Server (ELS) machine using BIND.


Prerequisites

You will need to have the ELS 'Extra Applications' CD-ROM mounted on /media/cdrom.


Installation

The following instructions describe how to install BIND using the ELS CD-ROM.

  1. Extract the BIND package into the root of the server's directory hierarchy.
  2. Create symbolic links for the BIND package's binaries in the /opt/bin and /opt/sbin directories.

Example

The example below shows how you would install version 9.9.1-P1 of BIND from the ELS CD-ROM.

cd /
tar -zxf /mount/cdrom/extra/bind-9.9.1-P1.i586.tar.gz

cd /opt/bin
ln -s ../bind-9.9.1-P1/bin/* .
cd /opt/sbin
ln -s ../bind-9.9.1-P1/sbin/* .

Configuration

After installing BIND, follow the steps below to configure a forwarding-only name server.

  1. Create a directory /etc/opt/bind to store the configuration file.
  2. Create the configuration file /etc/opt/bind/named.conf.
  3. Edit /etc/firewall to allow DNS replies from your ISP and restart the network subsystem to refresh the rules.
  4. Set named to start automatically at boot-up.

Example

The example below shows portions of the namd.conf and firewall files that have been changed as well as the commands used to set named for automatic start-up.

mkdir /etc/opt/bind
vi /etc/opt/bind/named.conf

options {
  directory "/etc/opt/bind";
  forwarders {
    10.10.10.53;
    10.10.11.53;
  };
};

vi /etc/firewall

-A INPUT -p udp -s 10.10.10.53 --sport 53 --dport 1024:65535 -j ACCEPT
-A INPUT -p udp -s 10.10.11.53 --sport 53 --dport 1024:65535 -j ACCEPT

/etc/init.d/network restart

chmod +x /etc/init.d/named

Note

The IP addresses shown are for demonstration purposes only and should be changed to match your network configuration.


Testing

You can test your setup by performing some DNS queries.

  1. Manually start named.
  2. Run nslookup and change the server to 127.0.0.1
  3. Look up some sites using their DNS names.
  4. Verify that IP addresses are returned.
  5. Repeat the process, but this time look up IP addresses and verify that DNS names are returned.

Here is an example of a successful test.

login: root
password:

# /etc/init.d/named start
DNS server is starting.

# nslookup
> server 127.0.0.1
Default server: 127.0.0.1
Address: 127.0.0.1#53
> www.ibiblio.org
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
Name:   www.ibiblio.org
Address: 152.46.7.80
> 152.46.7.80
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
80.7.46.152.in-addr.arpa        name = ibiblio.org.
80.7.46.152.in-addr.arpa        name = ibiblio.unc.edu.

If your test was not successful, here are some troubleshooting tips.

  1. Try the same queries in nslookup without changing the server address.
  2. Check the firewall rules with iptables -L -n and verify that UDP traffic is allowed in from your ISP's DNS servers on port 53.
  3. Use the command netstat -tln to verify that named is listening on port 53.

Additional Information

Once BIND is set up, you can edit /etc/resolv.conf and instruct the ELS system to use itself (127.0.0.1) for DNS lookups. You can also configure any workstations on your network to use the ELS machine as a DNS server.