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 15:29] Hypathie [Générer une clé d'authentification avec l'utilitaire rndc] |
utilisateurs:hypathie:tutos:dns-bind [31/08/2014 17:02] Hypathie [Côté client] |
||
---|---|---|---|
Ligne 52: | Ligne 52: | ||
===/usr/sbin/named=== | ===/usr/sbin/named=== | ||
- | Le programme qui lance le server : | + | Le programme qui lance le server. |
=== /usr/sbin/rndc=== | === /usr/sbin/rndc=== | ||
rndc est un utilitaire de contrôle. | rndc est un utilitaire de contrôle. | ||
+ | |||
+ | <code> | ||
+ | rndc |b source-adress] [-c config-file] [k key-file] [-s serveur] | ||
+ | [-p port] [-V] [-y key-id] {commande} | ||
+ | </code> | ||
+ | -> commandes : | ||
+ | |||
+ | **''reload''** : pour recharger\\ | ||
+ | **''stop''** : arrêter le serveur\\ | ||
+ | **''flush''** : vider le cache\\ | ||
+ | **''status''** : afficher l'état du serveur\\ | ||
+ | **aucune** : liste des commandes utilisables | ||
+ | |||
=== /etc/bind/named.conf=== | === /etc/bind/named.conf=== | ||
Ligne 182: | Ligne 196: | ||
<code root>cp /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.OLD</code> | <code root>cp /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.OLD</code> | ||
- | *Désactiver networkmanager : | + | ===Désactiver networkmanager === |
<code root>vim /etc/NetworkManager/NetworkManager.conf</code> | <code root>vim /etc/NetworkManager/NetworkManager.conf</code> | ||
<code> | <code> | ||
Ligne 500: | Ligne 514: | ||
* Générer une clé : | * Générer une clé : | ||
- | <code root>rndc-confgen</code> | + | <code root>rndc-confgen >/etc/bind/rndc.key</code> |
- | <code> | + | |
- | # Start of rndc.conf | + | |
- | key "rndc-key" { | + | |
- | algorithm hmac-md5; | + | |
- | secret "xxxxxxxxxxxxxxxxxxxx"; | + | |
- | }; | + | |
- | options { | + | * Ajouter la nouvelle clé à la fin de /etc/bind/named.conf : |
- | default-key "rndc-key"; | + | <code root>tail /etc/bind/rndc.key >> named.conf</code> |
- | 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: | + | * Éditer /etc/bind/named.conf: |
- | # key "rndc-key" { | + | <code root>vim /etc/bind/named.conf</code> |
- | # algorithm hmac-md5; | + | <code>include "/etc/bind/named.conf.options"; |
- | # secret "xxxxxxxxxxxxxxxxxxxxxx"; | + | include "/etc/bind/named.conf.local"; |
- | # }; | + | //include "/etc/bind/named.conf.default-zones"; |
- | # | + | key "rndc-key" { |
- | # controls { | + | algorithm hmac-md5; |
- | # inet 127.0.0.1 port 953 | + | secret "HnKmxWg2p6U0t6Ov+qoM8A=="; |
- | # allow { 127.0.0.1; } keys { "rndc-key"; }; | + | }; |
- | # }; | + | |
+ | controls { | ||
+ | inet 127.0.0.1 port 953 | ||
+ | allow { 127.0.0.1; } keys { "rndc-key"; }; | ||
+ | }; | ||
# End of named.conf | # End of named.conf | ||
</code> | </code> | ||
- | -> Le retour de cette commande a deux parties ;\\ | ||
- | -> Copier la première partie du retour\\ | + | * Éditer /etc/bind/rndc.key : |
- | dans les fichiers **''/etc/rndc.conf''** et **''/etc/rndc.key''** (qu'il faut créer). | + | <code root>vim /etc/bind/rndc.key</code> |
- | + | ||
- | -> Copier dans **''/etc/named.conf''** la deuxième partie du retour.\\ | + | |
- | + | ||
- | + | ||
- | * Création du fichier **/etc/rndc.conf** et copie de la première partie de la commande "rndc-confgen" : | + | |
- | + | ||
- | <code root>vim /etc/rndc.conf</code> | + | |
<code># Start of rndc.conf | <code># Start of rndc.conf | ||
key "rndc-key" { | key "rndc-key" { | ||
- | algorithm hmac-md5; | + | algorithm hmac-md5; |
- | secret "xxxxxxxxxxxxxxxxxxxxx"; | + | secret "HnKmxWg2p6U0t6Ov+qoM8A=="; |
}; | }; | ||
#options { | #options { | ||
- | # default-key "rndc-key"; | + | # default-key "rndc-key"; |
- | # default-server 127.0.0.1; | + | # default-server 127.0.0.1; |
- | # default-port 953; | + | # default-port 953; |
#}; | #}; | ||
- | # End of rndc.conf</code> | + | # End of rndc.conf |
- | *Création de **/etc/rndc.key** et copie de la première partie de la commande "rndc-confgen": | ||
- | <code root>vim /etc/rndc.key</code> | ||
- | |||
- | Création de /etc/named/conf et copie de la deuxième partie du retour : | ||
- | <code root>vim /etc/named.conf</code> | ||
- | <code> | ||
# Use with the following in named.conf, adjusting the allow list as needed: | # Use with the following in named.conf, adjusting the allow list as needed: | ||
- | key "rndc-key" { | + | # key "rndc-key" { |
- | algorithm hmac-md5; | + | # algorithm hmac-md5; |
- | secret "xxxxxxxxxxxxxxxxx"; | + | # secret "HnKmxWg2p6U0t6Ov+qoM8A=="; |
- | }; | + | # }; |
+ | # | ||
# controls { | # controls { | ||
- | # inet 127.0.0.1 port 953 | + | # inet 127.0.0.1 port 953 |
- | # allow { 127.0.0.1; } keys { "rndc-key"; }; | + | # allow { 127.0.0.1; } keys { "rndc-key"; }; |
# }; | # }; | ||
# End of named.conf | # End of named.conf | ||
</code> | </code> | ||
+ | ===Configurer les zones qui utilise la clé === | ||
- | ===Configuration de /etc/bind/named.conf === | + | * Éditer /etc/bind/named/conf.local : |
- | <code root>vim /etc/bind/named.conf</code> | + | <code root>vim /etc/bind/named.conf.local</code> |
- | <code> | + | <code>// |
- | include "/etc/bind/named.conf.options"; | + | // Do any local configuration here |
- | include "/etc/bind/named.conf.local"; | + | // |
- | //include "/etc/bind/named.conf.default-zones"; | + | |
- | include "/etc/rndc.key"; | + | |
- | controls { | + | // Consider adding the 1918 zones here, if they are not used in your |
- | inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; }; | + | // 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> | </code> | ||
+ | ===Relancer bind9=== | ||
- | ===Créer /etc/bind/rndc.conf et /etc/bind/rndc.key=== | + | <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> | ||
- | <code root>cp /etc/rndc.conf /etc/bind/rndc.conf | ||
- | </code> | ||
- | <code root>cp /etc/rndc.key /etc/bind/rndc.key</code> | + | Une deuxième fois : |
- | ===Relancer bind === | + | <code root>/etc/init.d/bind9 restart</code> |
- | <code root>service bind9 restart</code> | + | <code>[....] Stopping domain name service...: bind9waiting for pid 5441 to die |
- | <code>[....] Stopping domain name service...: bind9WARNING: key file (/etc/bind/rndc.key) exists, but using default configuration file (/etc/bind/rndc.conf) | + | |
- | rndc: no server specified and no default | + | |
. ok | . ok | ||
- | [ ok ] Starting domain name service...: bind9. | + | [ ok ] Starting domain name service...: bind9.</code> |
- | </code> | + | |
+ | =====Côté client ===== | ||
+ | Se débarrasser [[utilisateurs:hypathie:tutos:dns-bind?&#desactiver-networkmanager|de networkmanager]] avant tout.\\ | ||
- | <note> | + | *Il n'y a qu'un fichier à éditer "/etc/resolv.conf": |
- | *Vérifier la configuration : | + | |
- | + | ||
- | <code root>named-checkconf /etc/named.conf</code> | + | |
- | >Tout est bon, s'il y a retour du prompt. | + | |
- | + | ||
- | </note> | + | |
- | + | ||
- | * Redémarrer le service nommé. | + | |
- | <code root>rndc reload</code> | + | |
- | <note tip> | + | |
- | Pour un server distant\\ | + | |
- | + | ||
- | Utiliser la première partie de la commande **''rndc-confgen''** qui est à copier dans **''rndc.conf''** sur la machine qui lance rndc;\\ | + | |
- | et la deuxième partie cette commande est à copier dans **''named.conf''** sur le serveur distant. | + | |
- | </note> | + | |
+ | <code root>/vim /etc/resolv.conf</code> | ||
+ | <code> | ||
+ | domaine mondomaine.hyp | ||
+ | search mondomaine.hyp | ||
+ | nameserver 192.168.0.14 | ||
+ | </code> | ||
+ | * Puis recharger la configuration réseau : | ||
+ | <code root>/etc/init.d/networking start</code> | ||