Primary Master DNS for a LAN on Debian 6.0 (II)

We continue with our series of articles and in this one we will deal with the following aspects:

  • Installation
  • Directories and main files

Before continuing, we recommend that you do not stop reading:

Installation

In a console, as the root user , we install bind9 :

aptitude install bind9

We also need to install the dnsutils package , which has the necessary tools to perform DNS queries and diagnose functionality:

aptitude install dnsutils

If you want to consult the documentation that comes in the repository:

aptitude install bind9-doc

The documentation will be stored in the /usr/share/doc/bind9-doc/arm directory , and the index or Table of Contents file is Bv9ARM.html . To open it, run:

firefox / usr / share / doc / bind9-doc / arm / Bv9ARM.html

When we install bind9 on Debian, the bind9utils package is also installed, providing several very useful tools for maintaining a working BIND installation. These include rndc, named-checkconf, and named-checkzone . Additionally, the dnsutils package provides a suite of BIND client programs, including dig and nslookup . We will use all of these tools and commands in the following articles.

To see all the programs in each package, we must run as the root user :

dpkg -L bind9utils dpkg -L dnsutils

Or go to Synaptic , search for the package, and see which files are installed. Especially those installed in the /usr/bin or /usr/sbin folders.

If we want to know more about how to use each tool or program installed, we must execute:

man

Directories and main files

When you install Debian, the file /etc/resolv.conf is created . This file, or " resolver service configuration file ," contains several options, the defaults of which are the domain name and IP address of the DNS server declared during installation. Since the file's help documentation is in Spanish and very clear, we recommend reading it using the command `man resolv.conf`.

After installing bind9 in Squeeze, at least the following directories are created:

/ etc / bind / var / cache / bind / var / lib / bind

In the /etc/bind directory we find, among others, the following configuration files:

named.conf named.conf.options named.conf.default-zones named.conf.local rndc.key

In the /var/cache/bind directory , we will create the Local Zones files , which we will discuss later. Out of curiosity, run the following commands in a console as the root user :

ls -l / etc / bind ls -l / var / cache / bind

Of course, the last directory will not contain anything, as we have not yet created a Local Zone.

Dividing the BIND settings into multiple files is done for convenience and clarity. Each file has a specific function as we will see below:

named.conf : Main configuration file. It includes the files named.conf.options , named.conf.local , and named.conf.default-zones.

named.conf.options : General DNS service options. The directive: directory “/var/cache/bind” will tell bind9 where to look for the files of the created Local Zones. We also declare here the “ Forwarders ” servers, up to a maximum of 3, which are simply external DNS servers that we can query from our network (through a firewall, of course) that will answer the queries or requests that our local DNS is unable to answer.

For example, if we are configuring a DNS for the LAN 192.168.10.0/24 , and we want one of our Forwarders to be a Name Server of the UCI, we must declare the directive forwarders { 200.55.140.178; } ; IP address that corresponds to the server ns1.uci.cu.

This way, we can query our local DNS server for the IP address of the host yahoo.es (which is obviously not on our LAN), since our DNS will ask the UCI's DNS server if it knows the IP address of yahoo.es, and then give us a result, whether successful or not. We will also declare other important configuration aspects in the named.conf.option file , as we will see later.

named.conf.default-zones : As the name suggests, these are the default zones. Here, BIND is configured with the name of the file containing the information for the root servers needed to initialize the DNS cache, specifically the db.root file . BIND is also instructed to have full authority (authority) for localhost name resolution , for both forward and reverse lookups, and the same applies to the broadcast zones.

named.conf.local : File where we declare the local configuration of our DNS server using the name of each of the Local Zones , and which will be the DNS Record Files that will map the names of the computers connected to our LAN with their IP address and vice versa.

rndc.key : A generated file containing the key to control BIND. Using the BIND server control utility rndc , we can reload the DNS configuration without needing to restart it with the rndc reload command . This is very useful when making changes to the Local Zones files.

In Debian, Local Zone files can also be located in /var/lib/bind ; while in other distributions such as Red Hat and CentOS they are usually located in /var/lib/named or other directories depending on the level of security implemented.

We selected the /var/cache/bind directory because that's the one Debian suggests by default in the named.conf.options file . We can use any other directory as long as we tell bind9 where to look for the zone files, or provide the absolute path to each zone in the named.conf.local file . It's highly recommended to use the directories suggested by your distribution.

Discussing the additional security involved in creating a chroot for BIND is beyond the scope of this article. The same applies to security using the SELinux context. Those who need to implement such features should consult manuals or specialized literature. Remember that the bind9-doc documentation package is installed in the /usr/share/doc/bind9-doc directory.

Well Sirs, so far the 2nd Part. We do not want to dwell on a single article due to the good recommendations of our Chief. Finally! we'll get into the nitty-gritty of BIND Setup and Testing… in the next chapter.


Add as preferred source in Google