BIND9 : Ne fonctionne pas pour lui-même

Bonjour à tous, j’ai un serveur sur debian 6 avec entre autres bind9.

Il fonctionnait parfaitement depuis plusieurs années jusqu’à ce qu’il soit rallumé ce matin après 15j d’extinction.
Le serveur a pour nom : fwbinero et pour ip 10.0.0.1
Il est également serveur DHCP.
Il est également passerelle vers l’internet pour le réseau local (via l’interface eth1 : 192.168.1.2)
Ma box est en 192.168.1.1

Le service de bind fonctionne parfaitement pour les autres serveurs qui parviennent à résoudre les noms. Cependant, le serveur sur lequel tourne le service bind (donc fwbinero) ne résoud pas les noms locaux, uniquement les noms sur le wan.

Voici des exemples :
Nom local… ça ne fonctionne pas

root@fwbinero:~# host bdbinero

Host bdbinero not found: 2(SERVFAIL)

Sinon ça fonctionne…
root@fwbinero:~# host debian-fr.org

debian-fr.org has address 104.28.13.4
debian-fr.org has address 104.28.12.4
Host debian-fr.org.home not found: 4(NOTIMP)
debian-fr.org mail is handled by 10 omoikane.ptitoliv.net.
debian-fr.org mail is handled by 20 kaoru.asyd.net.

root@fwbinero:~# dig

; <<>> DiG 9.7.3 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11125
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       433292  IN      NS      h.root-servers.net.
.                       433292  IN      NS      k.root-servers.net.
.                       433292  IN      NS      f.root-servers.net.
.                       433292  IN      NS      b.root-servers.net.
.                       433292  IN      NS      j.root-servers.net.
.                       433292  IN      NS      a.root-servers.net.
.                       433292  IN      NS      g.root-servers.net.
.                       433292  IN      NS      m.root-servers.net.
.                       433292  IN      NS      l.root-servers.net.
.                       433292  IN      NS      e.root-servers.net.
.                       433292  IN      NS      i.root-servers.net.
.                       433292  IN      NS      d.root-servers.net.
.                       433292  IN      NS      c.root-servers.net.

;; Query time: 43 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Mon Aug 24 15:56:25 2015
;; MSG SIZE  rcvd: 228

root@fwbinero:~# nslookup bdbinero

Server:         192.168.1.1
Address:        192.168.1.1#53

** server can't find bdbinero: SERVFAIL

root@fwbinero:~# named-checkconf -z

zone localhost/IN: loaded serial 2
zone 127.in-addr.arpa/IN: loaded serial 1
zone 255.in-addr.arpa/IN: loaded serial 1
zone binero.corp/IN: loaded serial 970
zone binero.fr/IN: loaded serial 86
zone 0.0.10.in-addr.arpa/IN: loaded serial 648

Voici mes fichiers de conf :

cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
#iface eth0 inet dhcp

auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address "10.0.0.1"
        netmask "255.255.255.0"
        network "10.0.0.0"
        broadcast "10.0.0.255"
allow-hotplug eth0:0
iface eth0:0 inet static
        address "10.0.1.1"
        netmask "255.255.255.0"
        network "10.0.1.0"
        brodcast "10.0.1.255"
allow-hotplug eth1
iface eth1 inet static
        address "192.168.1.2"
        netmask "255.255.255.0"
        gateway "192.168.1.1"
        network "192.168.1.0"
        broadcast "192.168.1.255"

cat /etc/hosts

127.0.0.1       localhost
127.0.1.1       fwbinero.binero.corp    fwbinero

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

cat /etc/host.conf

multi on

cat /etc/bind/named.conf

// 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";

// prime the server with knowledge of the root servers
//zone "." {
//      type hint;
//      file "/etc/bind/db.root";
//};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};

#zone "0.in-addr.arpa" {
#       type master;
#       file "/etc/bind/db.0";
#};

zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};
include "/etc/bind/rndc.key";
include "/etc/bind/named.conf.local";

cat /etc/bind/named.conf.options

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

        // If there is a firewall between you and nameservers you want
        // 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
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

        forwarders {
                192.168.1.1;
        };

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};

cat /etc/bind/db.10

$ORIGIN .
$TTL 604800     ; 1 week
binero.corp             IN SOA  fwbinero.binero.corp. root.fwbinero.binero.corp. (
                                970        ; serial
                                604800     ; refresh (1 week)
                                86400      ; retry (1 day)
                                2419200    ; expire (4 weeks)
                                604800     ; minimum (1 week)
                                )
                        NS      fwbinero.binero.corp.
                        A       127.0.0.1
                        AAAA    ::1
$ORIGIN binero.corp.
bdbinero                A       10.0.0.2
fwbinero                A       10.0.0.1
sfbinero                A       10.0.0.3

cat /etc/bind/db.local

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
@       IN      AAAA    ::1

Je n’ai aucune erreur dans le syslog et le service démarre parfaitement bien.

MERCI DE VOTRE AIDE !!

On voit que tes requêtes DNS interrogent la box 192.168.1.1, pas le serveur local. Regarde dans /etc/resolv.conf.

Merci de ton aide Pascal !
Effectivement j’ai déjà modifié plusieurs fois le resolv.conf sans parvenir à ce que je veux. Là j’ai cette version :

root@fwbinero:~# cat /etc/resolv.conf

domain home search home nameserver 192.168.1.1

Que me conseilles-tu ? Merci à toi :slightly_smiling:

Ce fichier n’est-il pas modifié à la volée d’ailleurs avec les infos délivrées par le serveur DHCP ? Si je suis client de ma box ça expliquerait le problème…

De mettre une des adresses de la machine sur lesquelles BIND écoute à la place de celle de la box.

C’est fait, mais j’ai une autre erreur du coup.

root@fwbinero:~# cat /etc/resolv.conf

domain home
search home
nameserver 10.0.0.1

root@fwbinero:~# host bdbinero

Host bdbinero not found: 3(NXDOMAIN)

C’est bon ca fonctionne avec les bons domaine. Je ne sais pas pourquoi il y avait home.

root@fwbinero:~# cat /etc/resolv.conf

domain binero.corp
search binero.corp
nameserver 10.0.0.1

Cette erreur est normale. Ton serveur n’a pas de zone correspondant au domaine de recherche “home” spécifié dans /etc/resolv.conf. Essaie plutôt avec un nom pleinement qualifié.

Il se pourrait que le fichier resolv.conf ait été réécrit à l’insu de ton plein gré par un client DHCP avec des informations provenant du serveur DHCP de la box.

Note : inutile de mettre à la fois domain et search qui sont mutuellement exclusifs.

Merci Pascal de ta célérité.

Est-ce judicieux de mettre un chattr +i sur le resolv.conf pour éviter ce problème à l’avenir ?

Je ne suis pas favorable à ce genre de mesure qui ne fait que masquer le problème. Mais ce n’est que mon avis.

J’ai toujours quelques problèmes qui se sont accumulés.
Je n’ai plus d’accès internet sur une partie de mon lan (tous les PC sauf les serveurs).
J’ai un message d’erreur dans bind :

Je ne trouve pas vraiment de réponse sur internet. J’ai ce message depuis que j’ai modifié mon resolv.conf

Merci

Qu’entends-tu exactement par “plus d’accès internet” ? Connectivité IP ou résolution DNS ?
Qu’est-ce qui est différent dans la configuration réseau des serveurs et des PC ? Statique / DHCP ?

C’est un avertissement (warning), pas une erreur. L’heure correspond-elle à une action de ta part, comme l’exécution d’un traceroute par exemple ?