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 11:51] Hypathie [Configurer un server DNS Maître en local sous wheezy] |
utilisateurs:hypathie:tutos:dns-bind [31/08/2014 15:18] Hypathie [Configuration de bind en cache only] |
||
---|---|---|---|
Ligne 239: | Ligne 239: | ||
===Configuration de bind pour un serveur DNS maître local=== | ===Configuration de bind pour un serveur DNS maître local=== | ||
- | note tip> | + | <note tip> |
__Quelques commandes utiles lors de la configuration de bind9__ : | __Quelques commandes utiles lors de la configuration de bind9__ : | ||
Ligne 556: | Ligne 556: | ||
-> Le retour de cette commande a deux parties ;\\ | -> Le retour de cette commande a deux parties ;\\ | ||
- | -> Copier de "# Start of rndc.conf" à "# End of rndc.conf"\\ | + | -> Copier la première partie du retour\\ |
dans les fichiers **''/etc/rndc.conf''** et **''/etc/rndc.key''** (qu'il faut créer). | dans les fichiers **''/etc/rndc.conf''** et **''/etc/rndc.key''** (qu'il faut créer). | ||
- | -> Copier dans **''/etc/named.conf''** les directives entre "# Use with the following in named.conf, adjusting the allow list as needed:" et "# End of named.conf".\\ Bien sûr il faut dé-commenter en enlevant "#".\\ | + | -> Copier dans **''/etc/named.conf''** la deuxième partie du retour.\\ |
Ligne 571: | Ligne 571: | ||
}; | }; | ||
- | 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</code> | ||
Ligne 590: | Ligne 590: | ||
}; | }; | ||
- | 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> | ||
- | <note> | ||
- | *Vérifier la configuration : | ||
- | |||
- | <code root>named-checkconf /etc/named.conf<code> | ||
- | >Tout est bon, s'il y a retour du prompt. | ||
- | |||
- | Et | ||
- | |||
- | <code root>named-checkconf /etc/named.conf<code> | ||
- | >Là aussi, retour du prompt. | ||
- | </note> | ||
- | |||
- | * Redémarrer le service nommé. | ||
- | <code root>rndc reload</code> | ||
===Configuration de /etc/bind/named.conf === | ===Configuration de /etc/bind/named.conf === | ||
Ligne 616: | Ligne 602: | ||
<code root>vim /etc/bind/named.conf</code> | <code root>vim /etc/bind/named.conf</code> | ||
<code> | <code> | ||
- | // This is the primary configuration file for the BIND DNS server named. | ||
- | // | ||
- | // Please read /usr/share/doc/bind9/README.Debian.gz for information on the | ||
- | // structure of BIND configuration files in Debian, *BEFORE* you customize | ||
- | // this configuration file. | ||
- | // | ||
- | // If you are just adding zones, please do that in /etc/bind/named.conf.local | ||
- | |||
include "/etc/bind/named.conf.options"; | include "/etc/bind/named.conf.options"; | ||
include "/etc/bind/named.conf.local"; | include "/etc/bind/named.conf.local"; | ||
- | include "/etc/bind/named.conf.default-zones"; | + | //include "/etc/bind/named.conf.default-zones"; |
include "/etc/rndc.key"; | include "/etc/rndc.key"; | ||
controls { | controls { | ||
- | inet 127.0.0.1 allow { localhost; } keys { "xxxxxxxxxxxxx"; }; | + | inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; }; |
}; | }; | ||
- | |||
</code> | </code> | ||
- | *Relancer bind : | ||
- | <code root>service bind9 restart</code> | ||
+ | ===Créer /etc/bind/rndc.conf et /etc/bind/rndc.key=== | ||
- | <note tip> | + | <code root>cp /etc/rndc.conf /etc/bind/rndc.conf |
- | Pour un server distant\\ | + | </code> |
- | Utiliser la première partie de la commande **''rndc-confgen''** qui est à copier dans **''rndc.conf''** sur la machine qui lance rndc;\\ | + | <code root>cp /etc/rndc.key /etc/bind/rndc.key</code> |
- | et la deuxième partie cette commande est à copier dans **''named.conf''** sur le serveur distant. | + | |
- | </note> | + | |
+ | ===Relancer bind === | ||
- | + | <code root>service bind9 restart</code> | |
- | + | <code>[....] Stopping domain name service...: bind9WARNING: key file (/etc/bind/rndc.key) exists, but using default configuration file (/etc/bind/rndc.conf) | |
- | ===== Configuration de bind en cache only ===== | + | rndc: no server specified and no default |
- | + | . ok | |
- | ===Éditer le fichier /etc/bind/named.conf=== | + | [ ok ] Starting domain name service...: bind9. |
- | Il faut commenter la ligne **''include "/etc/bind/named.conf/example-zone";''**.\\ | + | |
- | Ainsi il ne fait autorité que la zone locale 127.0.0. | + | |
- | <code>vim /etc/bind/named.conf</code> | + | |
- | <code>// This is the primary configuration file for the BIND DNS server named. | + | |
- | // | + | |
- | // Please read /usr/share/doc/bind9/README.Debian.gz for information on the | + | |
- | // structure of BIND configuration files in Debian, *BEFORE* you customize | + | |
- | // this configuration file. | + | |
- | // | + | |
- | // If you are just adding zones, please do that in /etc/bind/named.conf.local | + | |
- | + | ||
- | include "/etc/bind/named.conf.options"; | + | |
- | include "/etc/bind/named.conf.local"; | + | |
- | //include "/etc/bind/named.conf.default-zones"; | + | |
</code> | </code> | ||
- | >On voit dans ce fichier le différents fichiers de configuration. | ||
- | > Il n'y a pas à modifier /etc/bind/named.con.default-zone. | ||
- | ===Éditer le fichier /etc/bind/named.conf.options=== | + | <note> |
- | Pour ajouter l'indication "forwarder only". | + | *Vérifier la configuration : |
- | <code root>options { | + | <code root>named-checkconf /etc/named.conf</code> |
- | directory "/var/cache/bind"; | + | >Tout est bon, s'il y a retour du prompt. |
- | // If there is a firewall between you and nameservers you want | + | </note> |
- | // 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 | + | * Redémarrer le service nommé. |
- | // nameservers, you probably want to use them as forwarders. | + | <code root>rndc reload</code> |
- | // Uncomment the following block, and insert the addresses replacing | + | <note tip> |
- | // the all-0's placeholder. | + | Pour un server distant\\ |
- | forwarders { | + | Utiliser la première partie de la commande **''rndc-confgen''** qui est à copier dans **''rndc.conf''** sur la machine qui lance rndc;\\ |
- | 192.168.0.1; | + | et la deuxième partie cette commande est à copier dans **''named.conf''** sur le serveur distant. |
- | 8.8.8.8; | + | </note> |
- | 8.8.4.4; | + | |
- | 212.27.40.240; | + | |
- | 212.27.40.241; | + | |
- | }; | + | |
- | + | ||
- | //======================================================================== | + | |
- | // 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-validation auto; | + | |
- | + | ||
- | auth-nxdomain no; # conform to RFC1035 | + | |
- | version none; | + | |
- | forward only; | + | |
- | // listen-on-v6 { any; }; | + | |
- | }; | + | |
- | + | ||
- | </code> | + | |
- | > on peut mettre aussi les serveur DNS de google "8.8.8.8" et "8.8.4.4". | + | |
- | ===Mettre l'adresse locale dans /etc/resolv.conf=== | ||
- | <code root>vim /etc/resolv.conf</code> | ||
- | <code>nameserver 127.0.0.1 | ||
- | nameserver 8.8.8.8 | ||
- | nameserver 8.8.4.4 | ||
- | nameserver 212.27.40.240 | ||
- | nameserver 212.27.40.241</code> | ||