Dns « maître »
Voyons comment installer puis configurer un serveur Dns « maître » sous environnement Gnu/Linux, en terminal Shell. Dans un autre article nous aborderons la configuration d'un serveur Dns « esclave ». La configuration qui suit nous servira de base pour cet autre article.
Installer bind9
apt-get install bind9 bind9-doc
Configuration du Dns « maître »
Fichier de configuration principal.
Il faut définir le domaine /zone dans le fichier /etc/bind/named.conf
.
zone "lantsei.local" {
type master;
file "/var/cache/bind/db.lantsei.local";
};
Fichier de configuration secondaire
Pour chaque domaine /zone à gérer il faut créer le fichier /var/cache/bind/db.lantsei.local
renseigné dans named.conf
:
$TTL 10800; 3 hours
@ IN SOA SRV1-DNS.lantsei.local. root.lantsei.local. (
2010011801 ; serial
18800; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; expire (1 week)
86400 ) ; minimum (1 day)
@ IN NS SRV1-MASTER.lantsei.local.
@ IN MX 10 SRV6-MAIL.lantsei.local.
SRV1-MASTERIN A 192.168.1.1
SRV2-SALVE IN A 192.168.1.2
SRV3-PROXY IN A 192.168.1.3
SRV4-BASE IN A 192.168.1.4
SRV5-DATA IN A 192.168.1.5
SRV6-MAIL IN A 192.168.1.6
SRV7-DMZ IN A 192.168.1.7
master IN CNAME SRV1-MASTER
slave IN CNAME SRV2-SLAVE
proxy IN CNAME SRV3-PROXY
squid IN CNAME SRV3-PROXY
base IN CNAME SRV4-BASE
ldap IN CNAME SRV4-BASE
data IN CNAME SRV5-DATA
mail IN CNAME SRV6-MAIL
dmz IN CNAME SRV7-DMZ
www IN CNAME SRV7-DMZ
Fichier de configuration principal
Il faut définir la résolution inverse du domaine /zone dans le fichier /etc/bind/named.conf
zone "1.168.192.in-addr.arpa" {
type master;
file "/var/cache/bind/db.lantsei.local.inv";
};
Fichier de configuration secondaire
Pour chaque résolution inverse du domaine /zone il faut créer le fichier /var/cache/bind/db.lantsei.local.inv
renseigné dansnamed.conf
$TTL 10800 ; 3 hours
@ IN SOA SRV1-MASTER.lantsei.local. root.lantsei.local. (
2010011801 ; serial
28800 ; refresh (8 hours)
7200; retry (2 hours)
604800 ; expire (1 week)
86400 ) ; minimum (1 day)
@ IN NS SRV1-MASTER.lantsei.local.
1 IN PTR SRV1-MASTER.lantsei.local.
2 IN PTR SRV2-SLAVE.lantsei.local.
3 IN PTR SRV3-PROXY.lantsei.local.
4 IN PTR SRV4-BASE.lantsei.local.
5 IN PTR SRV5-DATA.lantsei.local.
6 IN PTR SRV6-MAIL.lantsei.local.
7 IN PTR SRV9-DMZ.lantsei.local.
Demon et tests
Après chaque modification des fichiers de configurations il faut redémarrer le démon :
/etc/init.d/bind9 restart
Vérifier dans les logs (fichier), que le démarrage s'est correctement effectué :
tail -30 /var/log/syslog
Test nslookup
, en localhost
:
nslookup
> server 127.0.0.1
Default server: 127.0.0.1
Address: 127.0.0.1#53
> SRV1-MASTER.lantsei.local
Server: 127.0.0.1
Address:127.0.0.1#53
Name: SRV1-MASTER.lantsei.local
Address: 192.168.1.1
> 192.168.1.3
Server: 127.0.0.1
Address:127.0.0.1#53
3.1.168.192.in-addr.arpaname = SRV3-PROXY.lantsei.local.
> exit
Vérifier les fichiers de config :
named-checkconf /etc/bind/named.conf
Vérifier les fichiers zones
named-checkzone lantsei.local /var/cache/bind/db.lantsei.local
named-checkzone 1.168.192.in-addr.arpa /var/cache/bind/db.lantsei.local.inv