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 | ||
utilisateurs:hypathie:tutos:dns-bind [31/08/2014 16:47] Hypathie [Générer une clé d'authentification avec l'utilitaire rndc] |
utilisateurs:hypathie:tutos:dns-bind [29/09/2014 06:53] Hypathie [Configurer un server DNS Maître en local sous wheezy] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ======DNS : Bind ====== | + | ======DNS : Bind9 ====== |
- | * Objet : installer et configurer Bind | + | * Objet : installer un server DNS en local bind9 |
* Niveau requis : {{tag>débutant avisé}} | * Niveau requis : {{tag>débutant avisé}} | ||
* Commentaires : //Contexte d'utilisation du sujet du tuto. // | * Commentaires : //Contexte d'utilisation du sujet du tuto. // | ||
Ligne 188: | Ligne 188: | ||
===Déclarer un nom de domaine dans /etc/resolv.conf=== | ===Déclarer un nom de domaine dans /etc/resolv.conf=== | ||
- | Il faut pour que la configuration ne soit par effacer lors d'un redémarrage, désinstaller networmanager. | + | If faut déclarer un nom de domaine dans /etc/resolv.conf.\\ |
+ | Au passage on peut indiquer d'autre DNS extérieurs que ceux du FAI.\\ | ||
+ | Il faut pour que la nouvelle configuration du fichier /etc/resolv.conf ne soit par effacer lors d'un redémarrage, par networmanager créer un script.\\ | ||
+ | <note tip> | ||
+ | * Voir : [[https://wiki.debian.org/fr/NetworkConfiguration#Configuration_de_DNS_pour_network-manager]] | ||
- | * Désactiver "networkmanager : | + | * Attention la suppression de networkmanager déstabilise le système : |
- | <code root>service networking stop</code> | + | |
- | * Sauvegarder la configuration : | + | <code root>apt-get remove --purge network-manager-gnome netwok-manager</code> |
- | <code root>cp /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.OLD</code> | + | |
- | *Désactiver networkmanager : | + | </note> |
- | <code root>vim /etc/NetworkManager/NetworkManager.conf</code> | + | |
- | <code> | + | |
- | [ifupdown] | + | |
- | managed=true</code> | + | |
- | * Déclarer un nom de domaine dans /etc/resolv.conf: | + | On peut soit éditer le fichier **/etc/resolv.conf**, mais comme le script suivant est nécessaire pour ne pas être embêté par networmanager, on va modifier le fichier avec le script. |
- | Il faut éditer le fichier et ajouter les deux premières lignes, en remplaçant "mondomaine.hyp" par le nom choisi.\\ | + | |
- | Pour un serveur DNS cache, il n'est pas nécessaire d'acheté un nom de domaine auprès d'un registre. | + | |
- | <code root>vim /etc/resolv.conf</code> | + | * Création du script pour networkmanager : |
- | <code> | + | <code root>cd /etc/NetworkManager/</code> |
- | domain mondomaine.hyp | + | |
+ | <code root>touch /etc/NetworkManager/dispatcher.d/99-dns</code> | ||
+ | |||
+ | <code root>vim /etc/NetworkManager/dispatcher.d/99-dns</code> | ||
+ | <code>#!/bin/sh | ||
+ | echo "domain mondomaine.hyp" > /etc/resolv.conf | ||
+ | echo "search mondomaine.hyp" >> /etc/resolv.conf | ||
+ | echo "nameserver 127.0.0.1" >> /etc/resolv.conf | ||
+ | echo "nameserver 8.8.8.8" >> /etc/resolv.conf | ||
+ | echo "nameserver 8.8.4.4" >> /etc/resolv.conf</code> | ||
+ | |||
+ | >Adapter le contenu à la configuration | ||
+ | |||
+ | <code root>chmod 755 /etc/NetworkManager/dispatcher.d/99-dns</code> | ||
+ | |||
+ | * Exécution du script : | ||
+ | |||
+ | <code root>bash /etc/NetworkManager/dispatcher.d/99-dns</code> | ||
+ | <code root>less /etc/resolv.conf</code> | ||
+ | <code>domain mondomaine.hyp | ||
search mondomaine.hyp | search mondomaine.hyp | ||
nameserver 127.0.0.1 | nameserver 127.0.0.1 | ||
nameserver 8.8.8.8 | nameserver 8.8.8.8 | ||
nameserver 8.8.4.4 | nameserver 8.8.4.4 | ||
- | nameserver 212.27.40.240 | ||
- | nameserver 212.27.40.241 | ||
</code> | </code> | ||
+ | |||
* Redémarrer le réseau : | * Redémarrer le réseau : | ||
<code root>/etc/init.d/networking start</code> | <code root>/etc/init.d/networking start</code> | ||
- | |||
- | <note>Pour revenir en arrière :\\ | ||
- | |||
- | <code root>service networking stop</code> | ||
- | <code root>cp /etc/NetworkManager/NetworkManager.conf.OLD\ | ||
- | /etc/NetworkManager/NetworkManager.conf</code> | ||
- | <code root>service networking start</code> | ||
- | </note> | ||
====Installer et configurer bind ==== | ====Installer et configurer bind ==== | ||
===installation du paquetage=== | ===installation du paquetage=== | ||
<code root> | <code root> | ||
- | apt-get update apt-get | + | apt-get update |
</code> | </code> | ||
Ligne 517: | Ligne 523: | ||
* Ajouter la nouvelle clé à la fin de /etc/bind/named.conf : | * Ajouter la nouvelle clé à la fin de /etc/bind/named.conf : | ||
- | <code root>tail /etc/bind/rndc.key >> named.conf</code> | + | <code root>echo 'include "/etc/bind/rndc.key";' >> /etc/bind/named.conf</code> |
- | * Éditer /etc/bind/named.conf: | + | * Éditer /etc/bind/rndc.key pour commenter toute la fin à partir de ''option {'' : |
- | <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 "HnKmxWg2p6U0t6Ov+qoM8A=="; | + | |
- | }; | + | |
- | + | ||
- | 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 root>vim /etc/bind/rndc.key</code> | ||
<code># Start of rndc.conf | <code># Start of rndc.conf | ||
key "rndc-key" { | key "rndc-key" { | ||
algorithm hmac-md5; | algorithm hmac-md5; | ||
- | secret "HnKmxWg2p6U0t6Ov+qoM8A=="; | + | secret "xxxxxxxxxxxxxxxxx"; |
}; | }; | ||
Ligne 554: | Ligne 544: | ||
# key "rndc-key" { | # key "rndc-key" { | ||
# algorithm hmac-md5; | # algorithm hmac-md5; | ||
- | # secret "HnKmxWg2p6U0t6Ov+qoM8A=="; | + | # secret "xxxxxxxxxxxxxx"; |
# }; | # }; | ||
# | # | ||
Ligne 589: | Ligne 579: | ||
===Relancer bind9=== | ===Relancer bind9=== | ||
- | |||
- | <code root>/etc/init.d/bind9 restart</code> | ||
- | <code>[....] Stopping domain name service...: bind9rndc: connection to remote host closed | ||
- | This may indicate that | ||
- | * the remote server is using an older version of the command protocol, | ||
- | * this host is not authorized to connect, | ||
- | * the clocks are not synchronized, or | ||
- | * the key is invalid. | ||
- | waiting for pid 4979 to die | ||
- | . ok | ||
- | [ ok ] Starting domain name service...: bind9.</code> | ||
- | |||
- | |||
- | Une deuxième fois : | ||
<code root>/etc/init.d/bind9 restart</code> | <code root>/etc/init.d/bind9 restart</code> | ||
Ligne 611: | Ligne 587: | ||
=====Côté client ===== | =====Côté client ===== | ||
- | Se débarrasser de networkmanager avant tout.\\ | + | 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": | *Il n'y a qu'un fichier à éditer "/etc/resolv.conf": | ||
- | <code root>/vim /etc/resolv.conf</code> | + | <code root>vim /etc/resolv.conf</code> |
<code> | <code> |