Les noms utilisés dans le système DNS créent une hiérarchie, depuis une racine et en passant à travers une série d'espaces de noms de domaines pour atteindre un enregistrement individuel conduisant à un service ou un hôte.
Description : www.artduweb.com
vi /etc/bind/named.conf
# key DHCP-UPDATE : clef pour crypter les conversations DHCP-DNS
# type master : serveur primaire
# allow-transfer : autorise les updates vers le secondaire
# allow-update : autorise les enregistrements dynamiques par le DHCP
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
key DHCP_UPDATE {
algorithm hmac-md5;
secret PaSSw0rd;
};
zone "aldebaran.local" {
type master;
file "aldebaran.local.db";
#forwarders { 192.168.1.1; };
allow-transfer { 192.168.1.1; };
allow-update { key DHCP_UPDATE; };
};
zone "0.168.192.in-addr.arpa" {
type master;
file "192.168.0.db";
allow-transfer { 192.168.1.1; };
allow-update { key DHCP_UPDATE; };
};
zone "1.168.192.in-addr.arpa" {
type master;
file "192.168.1.db";
allow-transfer { 192.168.1.1; };
allow-update { key DHCP_UPDATE; };
};
zone "0.0.127.in-addr.arpa" {
type master;
file "127.0.0.db";
};
Voir Configuration de DHCP pour l'enregistrement dynamique DNS.
vi /etc/bind/named.conf.options
# stockage des zones :/var/cache/bind
# forward only : uniquement les redirecteurs
# forward first : redirecteur d'abord, DNS racines ensuite
# DNS PUBLIC GOOGLE : 8.8.8.8
# allow query : autorise les réseaux définis à interroger le DNS
options {
directory "/var/cache/bind";
forward only;
forwarders { 8.8.8.8; };
Allow-query { 127.0.0.1/8; 192.168.1.0/24; 192.168.2.0/24; };
};
$TTL 86400 ; 1 day
@ IN SOA srv-fw.aldebaran.local. admin.aldebaran.local. (
2011080481 ; serial
21600 ; refresh (6 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS srv-fw.aldebaran.local.
NS srv-dmz.aldebaran.local.
pc-linux IN A 192.168.0.50
pc-windows IN A 192.168.0.52
srv-dmz IN A 192.168.1.1
srv-dmz-bis IN A 192.168.1.100
srv-fw IN A 192.168.0.254
srv-fw IN A 192.168.1.254
srv-lan IN A 192.168.0.1
www IN CNAME srv.dmz.aldebaran.local.
intranet IN CNAME srv-dmz-bis.aldebaran.local.
mx IN CNAME srv-dmz.aldebaran.local.
$TTL 86400 ; 1 day
@ IN SOA srv-fw.aldebaran.local. admin.aldebaran.local. (
2011080419 ; serial
21600 ; refresh (6 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
3600 ; minimum (1 hour)
)
NS srv-fw.aldebaran.local.
NS srv-dmz.aldebaran.local.
1 IN PTR srv-lan.aldebaran.local.
150 IN PTR pc-linux.aldebaran.local.
254 IN PTR srv-fw.aldebaran.local.
50 IN PTR pc-linux.aldebaran.local.
52 IN PTR pc-windows.aldebaran.local.
$TTL 86400
@ IN SOA srv-fw.aldebaran.local. admin.aldebaran.local. (
2011080330 ;serial
21600 ;time to refresh
3600 ;time to retry
604800 ;time to expire
3600 ) ;negative TTL
IN NS srv-fw.aldebaran.local.
IN NS srv-dmz.aldebaran.local.
1 IN PTR srv-dmz.aldebaran.local.
254 IN PTR srv-fw.aldebaran.local.
$TTL 86400
@ IN SOA localhost. admin.localhost. (
2011081601
21600
3600
2W
3600)
IN NS localhost.
1 IN PTR localhost.
Le serveur primaire est configuré, n'oubliez pas d'incrémenter le SERIAL des fichiers de zones si vous effectuez des modifications.
Si vous rencontrez des soucis de restart du service après modification en mode dynamique, supprimez les journaux (ex: /var/cache/bind/aldebaran.local.db.jnl)
vi /etc/bind/named.conf
# type slave : serveur secondaire en RO
# masters { IP; } : déclaration du serveur primaire
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
zone "aldebaran.local" {
type slave;
file "aldebaran.local.db";
masters { 192.168.1.254; };
};
zone "0.168.192.in-addr.arpa" {
type slave;
file "192.168.0.db";
masters { 192.168.1.254; };
};
zone "1.168.192.in-addr.arpa" {
type slave;
file "192.168.1.db";
masters { 192.168.1.254; };
};
zone "0.0.127.in-addr.arpa" {
type master;
file "127.0.0.db";
};
vi /etc/bind/named.conf.options
# stockage des zones :/var/cache/bind
# forward only : uniquement les redirecteurs
# forward first : redirecteur d'abord, DNS racines ensuite
# DNS PUBLIC GOOGLE : 8.8.8.8
options {
directory "/var/cache/bind";
forward only;
forwarders {
8.8.8.8;
};
};
Le serveur secondaire est configuré, le simple fait de démarrer le bind va nous permettre de récupérer toutes les zones configurées sur le primaire.
vi /etc/nsswitch.conf
# Cette directive permet la prise en compte du resolv.conf hosts: files dns
vi /etc/resolv.conf
nameserver 192.168.0.254 nameserver 192.168.1.1 search aldebaran.local domain aldebaran.local
Le transfert de zone s'effectue un moyen d'un socket TCP vers le port 67.
vi /etc/bind/named.conf
include "/etc/bind/named.conf.logging";
vi /etc/bind/named.conf.logging
logging {
channel simple_log {
file "/var/log/bind/bind.log" versions 3 size 5m;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
category default {
simple_log;
};
};
mkdir /var/log/bind touch /var/log/bind/bind.log chown -R bind:bind /var/log/bind/
/etc/init.d/bind9 reload