Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
atelier:chantier:dns-bind9-sur-wheezy [01/09/2014 09:22] Hypathie [Configurer un server DNS Maître en local sous wheezy] |
atelier:chantier:dns-bind9-sur-wheezy [01/09/2014 10:25] Hypathie [Configurer un server DNS Maître en local sous wheezy] |
||
---|---|---|---|
Ligne 9: | Ligne 9: | ||
* Commentaires sur le forum : [[https://debian-facile.org/viewtopic.php?pid=97375#p97375 | Lien vers le forum concernant ce tuto]] ((N'hésitez pas à y faire part de vos remarques, succès, améliorations ou échecs !)) | * Commentaires sur le forum : [[https://debian-facile.org/viewtopic.php?pid=97375#p97375 | Lien vers le forum concernant ce tuto]] ((N'hésitez pas à y faire part de vos remarques, succès, améliorations ou échecs !)) | ||
+ | |||
+ | Source : [[http://archil.fr/Doc_install_BIND.html]] | ||
===== Introduction au DNS===== | ===== Introduction au DNS===== | ||
====Quelques bases sur les servers DNS ==== | ====Quelques bases sur les servers DNS ==== | ||
Ligne 431: | Ligne 433: | ||
<code root>/code>dig -x @192.168.0.14</code> | <code root>/code>dig -x @192.168.0.14</code> | ||
- | ====Interroger le DNS local sur un client du réseau ==== | + | ====Interroger le server DNS local au sujet d'un client du réseau ==== |
===Configuration === | ===Configuration === | ||
<code root>vim /etc/bind/db.mondomaine.hyp</code> | <code root>vim /etc/bind/db.mondomaine.hyp</code> | ||
Ligne 489: | Ligne 491: | ||
> exit</code> | > exit</code> | ||
+ | =====Générer une clé d'authentification avec l'utilitaire rndc===== | ||
- | =====Côté client ===== | + | Cet utilitaire permet d'administrer notre serveur. Après l'installation de Bind, la première chose à faire est de configurer rndc, ce qui consiste à configurer une clé d'authentification relative à la configuration de son réseau local.\\ |
- | Se débarrasser [[utilisateurs:hypathie:tutos:dns-bind?&#desactiver-networkmanager|de networkmanager]] avant tout.\\ | + | |
- | *Il n'y a qu'un fichier à éditer "/etc/resolv.conf": | + | BIND contient un utilitaire appelé rndc qui permet d'utiliser des lignes de commande pour administrer le démon named à partir de l'hôte local ou d'un hôte distant. |
- | <code root>vim /etc/resolv.conf</code> | + | Afin d'empêcher l'accès non-autorisé au démon named, BIND utilise une méthode d'authentification à clé secrète partagée pour accorder des privilèges aux hôtes. Ainsi, une clé identique doit être présente aussi bien dans /etc/named.conf que dans le fichier de configuration de rndc, à savoir /etc/rndc.conf. |
+ | <note> | ||
+ | __Remarques sur la configuration de rndc.__\\ | ||
+ | |||
+ | Pour utiliser rmdc à distance mettre sur la machine qui génère rndc les info données en sortie par la commande rndc-confgen à mettre dans **rndc.conf** et sur le serveur distant les infos à mettre dans **named.conf**. | ||
+ | |||
+ | </note> | ||
+ | |||
+ | * Dans /etc/bind/ on voit le fichier rndc.key : | ||
+ | |||
+ | <code root>ls /etc/bind/</code> | ||
<code> | <code> | ||
- | domaine mondomaine.hyp | + | bind.keys db.empty named.conf.default-zones zones.rfc1918 |
- | search mondomaine.hyp | + | db.0 db.local named.conf.local |
- | nameserver 192.168.0.14 | + | db.127 db.root named.conf.options |
+ | db.255 named.conf rndc.key | ||
</code> | </code> | ||
+ | |||
+ | <note warning> | ||
+ | **rndc.key ne s'édite pas !** | ||
+ | </note> | ||
+ | |||
+ | * Générer une clé : | ||
+ | |||
+ | <code root>rndc-confgen >/etc/bind/rndc.key</code> | ||
+ | |||
+ | * Ajouter la nouvelle clé à la fin de /etc/bind/named.conf : | ||
+ | <code root>tail /etc/bind/rndc.key >> named.conf</code> | ||
+ | |||
+ | * Éditer /etc/bind/named.conf: | ||
+ | <code root>vim /etc/bind/named.conf</code> | ||
+ | <code>include "/etc/bind/named.conf.options"; | ||
+ | include "/etc/bind/named.conf.local"; | ||
+ | //include "/etc/bind/named.conf.default-zones"; | ||
+ | key "rndc-key" { | ||
+ | algorithm hmac-md5; | ||
+ | secret "xxxxxxxxxxxx"; | ||
+ | }; | ||
+ | |||
+ | controls { | ||
+ | inet 127.0.0.1 port 953 | ||
+ | allow { 127.0.0.1; } keys { "rndc-key"; }; | ||
+ | }; | ||
+ | # End of named.conf | ||
+ | </code> | ||
+ | |||
+ | * Éditer /etc/bind/rndc.key : | ||
+ | <code root>vim /etc/bind/rndc.key</code> | ||
+ | <code># Start of rndc.conf | ||
+ | key "rndc-key" { | ||
+ | algorithm hmac-md5; | ||
+ | secret "xxxxxxxxxxxxxxxxx"; | ||
+ | }; | ||
+ | |||
+ | #options { | ||
+ | # default-key "rndc-key"; | ||
+ | # default-server 127.0.0.1; | ||
+ | # default-port 953; | ||
+ | #}; | ||
+ | # End of rndc.conf | ||
+ | |||
+ | # Use with the following in named.conf, adjusting the allow list as needed: | ||
+ | # key "rndc-key" { | ||
+ | # algorithm hmac-md5; | ||
+ | # secret "xxxxxxxxxxxxxx"; | ||
+ | # }; | ||
+ | # | ||
+ | # controls { | ||
+ | # inet 127.0.0.1 port 953 | ||
+ | # allow { 127.0.0.1; } keys { "rndc-key"; }; | ||
+ | # }; | ||
+ | # End of named.conf | ||
+ | </code> | ||
+ | |||
+ | ===Configurer les zones qui utilise la clé === | ||
+ | |||
+ | * Éditer /etc/bind/named/conf.local : | ||
+ | |||
+ | <code root>vim /etc/bind/named.conf.local</code> | ||
+ | <code>// | ||
+ | // Do any local configuration here | ||
+ | // | ||
+ | |||
+ | // Consider adding the 1918 zones here, if they are not used in your | ||
+ | // organization | ||
+ | //include "/etc/bind/zones.rfc1918"; | ||
+ | zone "mondomaine.hyp" { | ||
+ | type master; | ||
+ | file "/etc/bind/db.mondomaine.hyp"; | ||
+ | allow-update {key rndc-key;}; | ||
+ | }; | ||
+ | zone "0.168.192.in-addr.arpa" { | ||
+ | type master; | ||
+ | file "/etc/bind/db.192"; | ||
+ | allow-update {key rndc-key;}; | ||
+ | }; | ||
+ | </code> | ||
+ | |||
+ | ===Relancer bind9=== | ||
+ | |||
+ | <code root>/etc/init.d/bind9 restart</code> | ||
+ | |||
+ | <code>[....] Stopping domain name service...: bind9waiting for pid 5441 to die | ||
+ | . ok | ||
+ | [ ok ] Starting domain name service...: bind9.</code> | ||
+ | |||
+ | =====Côté client ===== | ||
+ | Installer le script pour networkmanager [[atelier:chantier:dns-bind9-sur-wheezy?&#declarer-un-nom-de-domaine-dans-etc-resolvconf|networkmanager]] avant tout.\\ | ||
+ | |||
* Puis recharger la configuration réseau : | * Puis recharger la configuration réseau : |