nano /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
//forwarders {
// www.xxx.yyy.zzz;
// www.xxx.yyy.zzz;
//};
Les forwarders sont désactivés (//) puisqu'on met en place un serveur DNS
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-enable yes;
dnssec-validation auto;
dnssec-lookaside auto;
On active le DNSSEC et ses paramètres
allow-query { localhost; 192.168.1.0/24; www.xxx.yyy.zzz; www.xxx.yyy.zzz/24; 2a01:cb1d:XXXX:YYYY::/64;};
allow-transfer { localhost; 192.168.1.0/24; 217.70.177.40; 2a01:cb1d:XXXX:YYYY::/64;};
On définit quelles machines sont autorisées à effectuer un query et un transfert
version "Bind 9";
On donne un nom à la version de bind
auth-nxdomain no; # conform to RFC1035
On laisse la directive de conformité à la norme RFC1035
listen-on-v6 { any; };
listen-on { any; };
Sur quelles IP on écoute en V6 et V4
allow-recursion { localhost; 192.168.1.0/24; 127.0.0.1; 2a01:cb1d:XXXX:YYYY::/64;};
On autorise la récursivité
notify yes;
};
On accepte la notification
nano /etc/bind/db.example.tld
; BIND data file for example.tld
;
$TTL 300
$ORIGIN example.tld.
@ IN SOA ns1.example.tld. hostmaster.example.tld. (
2019102722 ; Serial
1200 ; Refresh
600 ; Retry
2419200 ; Expire
3600) ; Negative Cache TTL
; Cles DNSSEC
$INCLUDE "/etc/bind/00_zones_local/example.tld/Kexample.tld.zsk.key";
$INCLUDE "/etc/bind/00_zones_local/example.tld/Kexample.tld.ksk.key";
; Serveurs de Nom: NS
@ IN NS ns1.example.tld.
IN NS ns6.gandi.net.
@ IN A www.xxx.yyy.zzz
ns6.gandi.net. IN A 217.70.177.40
; Serveur de Mail: MX
@ IN MX 10 mail.example.tld.
; Correspondances nom-IP
ns1 IN A www.xxx.yyy.zzz
ns1 IN AAAA 2a01:cb1d:UUUU:VVVVV:WWWW:XXXX:YYYY:ZZZZ
www IN A www.xxx.yyy.zzz
www IN AAAA 2a01:cb1d:UUUU:VVVVV:WWWW:XXXX:YYYY:ZZZZ
ftp IN A www.xxx.yyy.zzz
ftp IN AAAA 2a01:cb1d:UUUU:VVVVV:WWWW:XXXX:YYYY:ZZZZ
; Enregistrements CNAME
foo IN CNAME ftp
; Texte simple
@ IN TXT "Serveur DNS example.tld"
; Enregistrements SPF
@ IN TXT "v=spf1 ip4:www.xxx.yyy.zzz -all"
mail IN TXT "v=spf1 mx -all"
mail IN TXT "v=spf1 a ~all"
named-checkzone mondomaine.tld db.mondomaine.tld
Répond OK si la zone est conforme
named-checkconf named.conf.options
Ne renvoie rien s'il n'y a pas d'erreurs
/etc/init.d/bind9 restart
Sous Linux Debian, le nom de machine est déterminé au démarrage grâce au script /etc/init.d/hostname.sh à partir du contenu du fichier /etc/hostname. On peut donc changer très simplement le nom mais aussi le FQDN (fully qualified domain name) de la machine.
Attention, l'ordre dans lequel sont indiqués le FQDN et le nom de la machine est important dans le fichier /etc/hosts.
echo "ma-machine" > /etc/hostname
echo "127.0.0.1 ma-machine.mondomaine.tld ma-machine localhost" > /etc/hosts
/etc/init.d/hostname.sh
Les commandes suivantes doivent donc donner :
hostname
renvoie
ma-machine
et
hostname --fqdn
renvoie
ma-machine.mondomaine.tld
A lancer dans /etc/bind/atkhost.com/
dnssec-signzone -e20190101000001 -t -g -k Katkhost.com.ksk.key -o atkhost.com ../db.atkhost.com Katkhost.com.zsk.key
dnssec-signzone -e20190101000001 -t -g -k Klosdingos.fr.ksk.key -o losdingos.fr ../db.losdingos.fr Klosdingos.fr.zsk.key