jeudi 8 avril 2010

Comment monter un serveur DNS cache avec bind

Une des façons d'optimiser la bande passante de son réseau local vers l'Internet c'est de monter un serveur de nom cache, il peut être installé sur un serveur proxy transparent dans mon précèdent post sans problème . Il faut d'abord avoir les IP des serveurs de nom de votre ISP/FAI dans mon cas ce sont 196.192.32.5 et 41.188.9.130 . Dans l'exemple j'utilise bind sur une debian, ça marche aussi sur d'autre distribution comme ubuntu.

~# aptitude update
~# aptitude install bind9
~# ls -al /etc/bind/
total 60
drwxr-sr-x  2 root bind 4096 2010-04-07 14:40 .
drwxr-xr-x 80 root root 4096 2010-04-07 14:40 ..
-rw-r--r--  1 root root  601 2010-03-17 19:08 bind.keys
-rw-r--r--  1 root root  237 2010-03-17 19:08 db.0
-rw-r--r--  1 root root  271 2010-03-17 19:08 db.127
-rw-r--r--  1 root root  237 2010-03-17 19:08 db.255
-rw-r--r--  1 root root  353 2010-03-17 19:08 db.empty
-rw-r--r--  1 root root  270 2010-03-17 19:08 db.local
-rw-r--r--  1 root root 2940 2010-03-17 19:08 db.root
-rw-r--r--  1 root bind  463 2010-03-17 19:08 named.conf
-rw-r--r--  1 root bind  490 2010-03-17 19:08 named.conf.default-zones
-rw-r--r--  1 root bind  165 2010-03-17 19:08 named.conf.local
-rw-r--r--  1 root bind  572 2010-03-17 19:08 named.conf.options
-rw-r-----  1 bind bind   77 2010-04-07 14:40 rndc.key
-rw-r--r--  1 root root 1317 2010-03-17 19:08 zones.rfc1918


Changer le fichier named.conf.options comme ci-dessous en précisant le réseau local et les adresses IP des serveurs de nom de votre ISP :


acl "trusted" {
192.168.0.0/24;
};

options {
directory "/var/cache/bind";

forwarders {
196.192.32.5;
41.188.9.130;
};

auth-nxdomain no;
listen-on-v6 { any; };

allow-query { trusted; };
};


Redémarrer le service :


~# /etc/init.d/bind9 restart
Stopping domain name service...: bind9 waiting for pid 14528 to die.
Starting domain name service...: bind9.


ou


~# service bind9 restart
Stopping domain name service...: bind9 waiting for pid 15057 to die.
Starting domain name service...: bind9.


Modifier le /etc/resolv.conf, j'ai mis 127.0.0.1 en première ligne :


nameserver 127.0.0.1
nameserver 196.192.32.5
nameserver 41.188.9.130

Aucun commentaire:

Enregistrer un commentaire