Intranet - Installing a DNS

December 2016

Packages needed for installation

A DNS (domain name server) is a server that links names to the IP addresses of computers on a network. In order to set up such a server, it is necessary to install bind and named. They can be downloaded as RPM files (for Mandrake they are bind-8.2.2P5-1mdk.i586.rpm and nameserver-6.0-3mdk.noarch.rpm; other distributions can be downloaded from freshmeat.net or rpmfind.net)

The server tuxserver (with the IP 192.168.1.1) is going to be configured as a domain name server, so as to allow clients (a Linux machine with the IP address 192.168.1.20 and a Windows machine with the IP address 192.168.1.30 - the subnet mask is 255.255.255.0) to access the services bearing the following names:

  • web server: www.tuxdomain
  • SMTP server: smtp.tuxdomain
  • POP server: pop.tuxdomain
  • News server: news.tuxdomain

Installing packages

Installating RPM packages is very simple. Just type the following commands:

rpm -ivh bind-8.2.2P5-1mdk.i586.rpm 
rpm -ivh caching-nameserver-6.0-3mdk.noarch.rpm

Before you start

Before you configure the name server, you have to edit the file /etc/resolv.conf so as to declare the domain name of your choice (here tuxdomain) and declare the local machine (with the local loop IP address - 127.0.0.1) as a name server.

So you have to make sure that the following lines are found in the file /etc/resolv.conf:

domain tuxdomain
nameserver 127.0.0.1

Adding the domain

After having installed bind and named, you can assign the domain name tuxdomain by editing the file /etc/named.conf:

options {
directory "/var/named";

};

//
// Declaring the reverse lookup zone
//
zone "0.0.127.in-addr.arpa" {
type master;

file "named.local";

};

zone "1.168.192.in-addr.arpa" {
notify no;

type master;

file "tuxdomain.rev
";

};

//
// Declaration for domain name resolution
//

zone "tuxdomain" {
notify no;

type master;

file "tuxdomain"
;

}

The first part serves as reverse lookup, meaning that it is used to find the name of a computer when given its IP address.

Creating zone files

Next, edit the file named.local found in the directory /var/named :

@	   IN	  SOA	 tuxserver.tuxdomain.
root.tuxserver.tuxdomain.


(
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS tuxserver.tuxdomain.
1 IN PTR localhost.

Finally, create a file called tuxdomain in the directory /var/named containing the following:

@	   IN	  SOA	 tuxserver.tuxdomain.
root.tuxserver.tuxdomain.


(
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum

TXT "Primary DNS server"

NS tuxserver

NS tuxserver.tuxdomain.

MX 10 tuxserver

MX 20 tuxserver.tuxdomain.

localhost A 127.0.0.1

tuxserver A 192.168.1.1

www CNAME tuxserver

smtp CNAME tuxserver

pop CNAME tuxserver

news CNAME tuxserver

tux A 192.168.1.20

win A 192.168.1.30

...

MX is used to specify the name of the SMTP server Here, our server tuxserver hosts all of the services.

For reverse lookup, you need to create a file named tuxdomain.rev within /var/named containing the reverse lookup table:

@	   IN	  SOA	 tuxserver.tuxdomain.
root.tuxserver.tuxdomain.


(

1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum

IN NS tuxserver.tuxdomain.

1 IN PTR tuxserver.tuxdomain.

20 IN PTR tux.tuxdomain.

30 IN PTR win.tuxdomain.

...

Booting up the DNS

The daemon named (a daemon is an application which runs permanently in the background) may be loaded manually using the command:

/etc/rc.d/init.d/named start
In order to have the daemon named launch automatically when your computer starts, it is helpful to create links using the commands
chkconfig --level 345 named on
chkconfig --level 0126 named off

To test if it is working properly, it is recommended to "ping" the other machines on the network with the command:

ping tux

Michel Maudet


Related :


Intranet - Instalación de un DNS
Intranet - Instalación de un DNS
Intranet - Installation du DNS
Intranet - Installation du DNS
Intranet - Installation du DNS
Intranet - Installation du DNS
Intranet - Installazione di DNS
Intranet - Installazione di DNS
Intranet - Instalação do DNS
Intranet - Instalação do DNS
This document entitled « Intranet - Installing a DNS » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.