Search The Site

Setup and Configure A DNS Server In Debian

A private internal DNS server is an excellent choice in setting up a public accessible DNS server to access a web server or other services hosted on your internal network. Keeping track of the host file for every client on your network can be tedious. Maintaining host information in one central area and allowing DNS to manage host names is more efficient. A DNS server doesn’t need much in the way of hardware or bandwidth. DNS requests are very low-bandwidth; after all, a single UDP packet is all it takes to satisfy a request. Ideally, you’ll have enough RAM to keep all zone and cache data in memory.

Setup DNS on Debian

Bind, otherwise known as the Berkeley Internet Naming Daemon. Complete the following steps to install and configure Bind 9 on your Debian Server.

  • First we need to check if we have Bind installed. Type the following in a terminal window. aptitude search bind
  • Next, we install the Bind service by typing the following command aptitude install bind9
  • Upon initial install the Bind service is setup as a caching only DNS server, you can have hosts query against it and your server will memorize any values that are returned from remote DNS hosts, thus providing faster subsequent resolution. So, the initial install is a caching only server regardless of any Linux distribution.
  • Next, we can see what is installed by typing the following in a terminal window. dpkg -l | grep bind
  • If you have security or router related concerns you should familiarize yourself with the service by reading the documentation. You can install the documentation for the service by typing the following: aptitude install bind9-doc
  • If you would like to check if Bind is running type the following in a terminal window: netstat -ant | grep 53 Notice we are grepping port 53 for the info. Bind by default will bind to port 53, it will function on both TCP and UDP. To confirm what I just said type this command netstat -anu | grep 53 Notice the u specified for UDP.
  • Remember, this is a caching only server, it is non-authoratative it will answer requests from requesters. If you are a home user and want to run in caching only mode for faster browsing just open up your etc/resolv.conf file and edit the values with your ISP's DNS server addresses.
  • Once we install zones the server will then be an authoratative server for our zones. In order to make the changes official on the internet we need to update the registrars on the internet with our domain info, then our linux server will become the authoratative DNS server on the internet for our domains.
  • Next, we need to tweak some of the configuration files that are available. The sub directory that houses the config files exists in etc change directories to etc and then type ls bind
  • Launch a terminal window and type the following: nano /etc/bind/named.conf

Insert the following in the named.conf file you have open in nano:

#Replace seowebz.com with your own domain name.
zone “seowebz.com” {
type master;
file “/etc/bind/db.seowebz.com”;
};
 
Save and exit the file.

Step 3: Next, we need to copy the db.local file and save it as our company domain db file. To copy db.local type the following in a terminal window: cp db.local db.seowebz.com next, we need to modify the file we just created, type the following: nano db.seowebz.com and enter the following information in the file: Refer to the illustration below for info to input. When finished save and close the file.

create virtual machine

You will notice in the screenshot above there is a field to place the serial number. The serial number should stipulate the date you made the record, plus the number of the changes to the record. In the example above the date I used was May 10th 2011 plus the 02 for the second change.

  • Next, restart the daemon by typing the following: /etc/init.d/bind9 restart

Next, we need to setup a reverse zone file for the domain. Type the following in a terminal window:

  • nano /etc/bind/named.conf and enter the following information:
  • zone "4.168.192.in-addr.arpa" {
    type master;
    file "4.168.192.in-addr.arpa.zone";
    };

That is it, we now have a functioning authoratative DNS server. Your company db file should look similar to the illustration below:

create virtual machine

That is it, you should be up and running. I am only human so if you see an error please let me know by leaving a comment. Create a great day!

Upon initial install the Bind service is setup as a caching only DNS server, you can have hosts query against it and your server will memorize any values that are returned from remote DNS hosts, thus providing faster subsequent resolution. So, the initial install is a caching only server regardless of any Linux distribution.