Search


print PDF Ireland
Introduction

The DNS is a service, whose the purpose is to make the network more convivial, to assign symbolic names ...
This guide explains how to install a name server (DNS server). The DNS server (BIND8 version) needs several configuration files for this functioning:

  • named.conf: main file containing the information on the resolution zone and the different options of functioning
  • /etc/resolv.conf: This file allows to configure until 3 name servers, the two last ones being the substitutes of the first one in case of no response.
  • /etc/nsswitch.conf: configuration of the part of the C library, which refers to the names service.

WARNING: the OVH systems have already the configuration. You can also find the standard scripts of compilation on our server: ftp://ftp.ovh.net/made-in-ovh/patch


Delete the files and kill the process named

Erase the files /etc/named.conf and /etc/named and kill the process named if it exists.
type: $ rm -r /var/named/ then $ rm /etc/named.conf

Install the bind Server

To install bind, we need to install the following rpm bind-8......rpm (use the latest version). Then use this command to install the rpm:

rpm -i bind-8.....rpm and the packet caching-nameserver (this packet isn't necessary but it installs the named.conf file and /var/named/named.ca and /var/named/named.local, it also sets named.boot up, which isn't used in the 8 version of bind) It allows to configure a DNS cache (we can compile the source). In addition, it installs also the bind-uti packet, we use it to test the configuration.

We obtain the following files:

/etc/named.conf: contains the general parameters
/var/named/named.ca: indicates the DNS servers root
/var/named/named.local: local resolution of loopback addresses

According to your needs, you have to create the following files:

/var/named/your-domain.com.hosts: this file associates an Ip address and a system name

Configuration of named.conf file

/etc/named.conf

/ generated by named-bootconf.pl
//
// a caching only nameserver config
//

options {
directory "/var/named";
};

controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};

zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};

include "/etc/rndc.key";


Configuration of named.ca file

/var/named/named.ca

; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . "
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Aug 22, 1997
; related version of root zone: 1997082200
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; temporarily housed at NSI (InterNIC)
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
;
; housed in LINX, operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; temporarily housed at ISI (IANA)
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; housed in Japan, operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File


Configuration of named.local file

/var/named/named.local

$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh (every 8 hours)
14400 ; Retry (every 4 hours)
3600000 ; Expire
86400 ) ; Minimum (Minimal time of life: 24h)
IN NS localhost.

1 IN PTR localhost.


Configuration of your-domain.com.hosts file

/var/named/yourdomain.com.hosts

$ttl 86400
yourdomain.com. IN SOA nsxxxxx.ovh.net. webmaster.yourdomain.com. (
2004011801
21600
3600
604800
86400 )
IN NS nsxxxxx.ovh.net.
IN NS ns.ovh.net.
IN MX 10 mail.votredomaine.
IN A 213.186.32.xx
www IN A 213.186.32.xx
mail IN A 213.186.32.xx
smtp IN A 213.186.32.xx
pop IN A 213.186.32.xx
pop3 IN A 213.186.32.xx
imap IN A 213.186.32.xx
sql IN A 213.186.32.xx
mysql IN A 213.186.32.xx


Configuration of nsswitch.conf

/etc/nsswitch.conf

passwd: files nisplus
shadow: files nisplus
group: files nisplus

#hosts: db files nisplus nis dns
hosts: files nisplus dns

# Example - obey only what nisplus tells us...
#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers: files
netmasks: files
networks: files
protocols: files nisplus
rpc: files
services: files nisplus

netgroup: files nisplus

publickey: nisplus

#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers: files
netmasks: files
networks: files
protocols: files nisplus
rpc: files
services: files nisplus

netgroup: files nisplus

publickey: nisplus

automount: files nisplus
aliases: files nisplus


Configuration of resolv.conf file (OVH)

nameserver 127.0.0.1
nameserver 213.186.xx.xx (IP of your machine)
nameserver 213.186.33.99


nslookup

The nslookup tool allows to request a name server (DNS server) to have the information on a domain or on a system. By default nslookup uses the name server configured on your system, however you can request an other name server.

root@xxx /#nslookup

Default Server: localhost because I have a DNS server on my system.
Address: 127.0.0.1

help: to have help
set type: MX to list all the entries of kind MX (SMTP server of the domain)
your domain: the domain name whose you want to have MX
Replace MX by the kind of record that you want to have. For example NS for the name servers of a domain, SOA for start of authority, PTR for the reverse, A for a system.
To have all the information
set type=ANY then the domain name
We can also use the ls -t CNAME domain-namec ommand to have all the records of CNAME type. To request another DNS server than your server by default: server NAME 213.186.xx.xx

To apply all the changes without reboot :

cp -f /etc/resolv.homenet /resolv.conf # (warning with the spaces)
/etc/rc.d/init.d/named restart
rndc reload


Edit a record file 127.0.0

/var/named/named.local

$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

1 IN PTR localhost.


Edit a record file localhost

/var/named/localhost.zone

$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS @
1D IN A 127.0.0.1


Edit a record file of a domain

/var/named/votredomaine.com.hosts

$ttl 86400
david.com. IN SOA nsxxxxx.ovh.net. webmaster.yourdomain.com. (
2004011801
21600
3600
604800
86400 )

IN NS nsxxxxx.ovh.net.
IN NS ns.ovh.net.
IN MX 10 mail.votredomaine.
IN A 213.186.32.xx
www IN A 213.186.32.xx
mail IN A 213.186.32.xx
smtp IN A 213.186.32.xx
pop IN A 213.186.32.xx
pop3 IN A 213.186.32.xx
imap IN A 213.186.32.xx
sql IN A 213.186.32.xx
mysql IN A 213.186.32.xx


Troubleshooting with the bind module

Problem with the bind module in webmin on recent installations: you have error messages about "missing servers module"

Install servers.wbm (http://www.webmin.com/)