[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: initiation bind9



Salut,
je sais pas si ça me dépannera se soir mais ça apporte de l'eau à mon moulin, une config à plat c'est interessant.(St clou)

Jean-Yves F. Barbier a écrit :
lionel jousset a écrit :
 Merci,
ton exemple m'a beaucoup aidé à mieux comprendre comment structurer un serveur de noms enfin un petit peu mieux. Du coup j'ai revu ma copie pour créer le domaine de mon réseau local yoyo.lan et la deuxième zone site.local pour répondre au développement que j'ai a faire.

yoyo.lan marche trés bien, c'est pratiquement un copier-coller de ton exemple. par contre la zone site.local reste inaccessible et ça me laisse perplexe.
................
 > j'ai essayé de multiples combinaisons dans db.site.local mais rien à
faire ping site.local répond unknown host.
Il y a pas d'interdiction à ce que deux zones pointent vers la même ip ??

Lionel.

Bon si ça peut t'aider (et d'autres, parce que quand j'ai gratté cela, j'en
ai vraiment chibavé à l'époque), voici mes propres fichiers; compilation (en
son temps) d'un tas de howtos, man et discussions diverses:


/etc/resolv.conf:
==============================================================================
search defcon1
domain defcon1
nameserver 192.168.1.175
nameserver 192.168.1.1

(pour uniformiser mes fichiers de conf, je n'utilise que très peu 'localhost' et préfère reboucler sur l'I/F ethernet; les autres te dirons s'ils considèrent
cela bon ou pas)
Il-Y-a surement quelques maladresses, mais ça fonctionne nickel depuis pas mal
d'années, alors, j'ai laissé en l'état :)

Sachant que j'ai 3 DNS:
192.168.1.175  smtp.defcon1 (alias ns1)
192.168.1.1    fwall.defcon1 (alias ns2)
(fwall ne résolvant pas les adresses internes et le 3ème DNS ne relève
 pas de cette discussion)



/etc/bind/named.conf:
==============================================================================
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";
};

include "/etc/bind/named.conf.local";

/////////////

// Mes zones

// Zone reverse du LAN
zone "1.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.192";
};




/etc/bind/named.conf.options:
==============================================================================
options {
        directory "/var/cache/bind";

// Forwarder disabled: I don't like Free to track me on my searches
//      forwarders {
            // DNS de FREE
//          212.27.32.5;
//          212.27.32.176;
//          212.27.32.177;
//      };

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

        // Limiter les réponses au LAN et au NS
        allow-query {
            127.0.0.1;
            192.168.1.0/24;
        };

        // Pour la partie MASTER/SLAVE
//      dnssec-enable   yes;
};



/etc/bind/named.conf.local:
==============================================================================
Pour l'instant, est un fichier ne comprenant qu'une ligne de commentaire.



/etc/bind/db.127:
==============================================================================
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                2007020101              ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
1.0.0   IN      PTR     localhost.



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



/etc/bind/db.192:
==============================================================================
$TTL 604800     ; 1 week
;
$ORIGIN 1.168.192.IN-ADDR.ARPA.
;
@       IN      SOA     localhost. root.localhost. (
                                2007020101 ; serial
                                604800     ; refresh (1 week)
                                86400      ; retry (1 day)
                                2419200    ; expire (4 weeks)
                                604800     ; minimum (1 week)
                                )
;
                IN NS   smtp.defcon1.
                IN NS   fwall.defcon1.
;
1               IN PTR  fwall.defcon1.
;;;
25              IN PTR  anubis.defcon1.
26              IN PTR  anubisxp.defcon1.
27              IN PTR  anubisvl.defcon1.
;;;
50              IN PTR  osiris.defcon1.
51              IN PTR  osirisxp.defcon1.
;;;
75              IN PTR  isis.defcon1.
100             IN PTR  thot.defcon1.
125             IN PTR  apophis.defcon1.
150             IN PTR  ankh.defcon1.
;;;
175             IN PTR  smtp.defcon1.
176             IN PTR  smtpxp.defcon1.
;;; 2 BOITIERS SIP (1 FXO + 1 FXS)
180             IN PTR  ht488-free.defcon1.
181             IN PTR  ht488-ft.defcon1.
;;; MACHINE "INVITEE" (En Gal, en réparation)
199             IN PTR  guest.defcon1.
200             IN PTR  twisteddev.defcon1.
225             IN PTR  athor.defcon1.
;######   LTSP CONFIG(s)   ######
201             IN PTR  raminagrobis.defcon1.
;######   IMPRIMANTE   ######
254             IN PTR  hplj.defcon1.
;#########################################################
@                       IN      NS      smtp.defcon1.



/etc/bind/db.defcon1: (ATTENTION T IMPORTANT: CA DOIT-ETRE ABSOLUMENT TON NOM
                       DE LAN QUI SUIT 'db.' =>>> 'db.yoyo.lan')
==============================================================================
$TTL 1W ; 1 semaine
;
@               IN              SOA     ns2.defcon1. hostmaster.defcon1. (
                                2007020101 ; serial
                                8H         ; refresh (8 heures)
                                2H         ; retry (2 heures)
                                4W         ; expire (4 semaines)
                                1D         ; minimum (1 jour)
                                )
;
@               IN NS   smtp.defcon1.
@               IN NS   fwall.defcon1.
defcon1.        IN MX   10      smtp.defcon1.   ; Primary mail exchanger
;
;### Serveur par défaut de ma zone
defcon1.        IN A    192.168.1.75
defcon1.        IN TXT  "v=spf1 ip4:192.168.1.175 a mx -all"
;
ankh            IN A    192.168.1.150
;;;
anubis          IN A    192.168.1.25
anubisxp        IN A    192.168.1.26
anubisvl        IN A    192.168.1.27
;;;
apophis         IN A    192.168.1.125
;;;asus         IN A    192.168.1.200
twisteddev      IN A    192.168.1.200
athor           IN A    192.168.1.225
fwall           IN A    192.168.1.1
isis            IN A    192.168.1.75
;;;
osiris          IN A    192.168.1.50
osirisxp        IN A    192.168.1.51
;;;
smtp            IN A    192.168.1.175
smtpxp          IN A    192.168.1.176
;;;
ht488-free      IN A    192.168.1.180
ht488-ft        IN A    192.168.1.181
;;;
thot            IN A    192.168.1.100
;######   LTSP CONFIG(s)   ######
raminagrobis    IN A    192.168.1.201
;######   IMPRIMANTE HP LaserJet 2100 T/N PS2
hplj            IN A    192.168.1.254
;######   MACHINE "INVITEE" (En Gal en réparation)   ######
guest                   IN A    192.168.1.199
;######   ALIASES   ######
ns1                     IN CNAME        fwall.defcon1.
ntp                     IN CNAME        fwall.defcon1.
ns2                     IN CNAME        smtp.defcon1.
www                     IN CNAME        isis.defcon1.
blog                    IN CNAME        isis.defcon1.
cvs                     IN CNAME        isis.defcon1.
lists                   IN CNAME        isis.defcon1.
download                IN CNAME        isis.defcon1.
asterisk                IN CNAME        smtp.defcon1.



/etc/bind/db.root: Comme les adresses des root.servers (ceux qui contiennent *toutes* les adresses de tout l'internet)changent plus ou moins souvent, un cron en fait l'acquisition chaque mois

c'est db.root qui fait cache pour les addresses extérieures si je comprend bien

==============================================================================
; <<>> DiG 9.3.4 <<>> @a.root-servers.net. . ns
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51382
;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       518400  IN      NS      J.ROOT-SERVERS.NET.
.                       518400  IN      NS      K.ROOT-SERVERS.NET.
.                       518400  IN      NS      L.ROOT-SERVERS.NET.
.                       518400  IN      NS      M.ROOT-SERVERS.NET.
.                       518400  IN      NS      A.ROOT-SERVERS.NET.
.                       518400  IN      NS      B.ROOT-SERVERS.NET.
.                       518400  IN      NS      C.ROOT-SERVERS.NET.
.                       518400  IN      NS      D.ROOT-SERVERS.NET.
.                       518400  IN      NS      E.ROOT-SERVERS.NET.
.                       518400  IN      NS      F.ROOT-SERVERS.NET.
.                       518400  IN      NS      G.ROOT-SERVERS.NET.
.                       518400  IN      NS      H.ROOT-SERVERS.NET.
.                       518400  IN      NS      I.ROOT-SERVERS.NET.

;; ADDITIONAL SECTION:
A.ROOT-SERVERS.NET.     3600000 IN      A       198.41.0.4
B.ROOT-SERVERS.NET.     3600000 IN      A       192.228.79.201
C.ROOT-SERVERS.NET.     3600000 IN      A       192.33.4.12
D.ROOT-SERVERS.NET.     3600000 IN      A       128.8.10.90
E.ROOT-SERVERS.NET.     3600000 IN      A       192.203.230.10
F.ROOT-SERVERS.NET.     3600000 IN      A       192.5.5.241
G.ROOT-SERVERS.NET.     3600000 IN      A       192.112.36.4
H.ROOT-SERVERS.NET.     3600000 IN      A       128.63.2.53
I.ROOT-SERVERS.NET.     3600000 IN      A       192.36.148.17
J.ROOT-SERVERS.NET.     3600000 IN      A       192.58.128.30
K.ROOT-SERVERS.NET.     3600000 IN      A       193.0.14.129
L.ROOT-SERVERS.NET.     3600000 IN      A       198.32.64.12
M.ROOT-SERVERS.NET.     3600000 IN      A       202.12.27.33

;; Query time: 132 msec
;; SERVER: 198.41.0.4#53(198.41.0.4)
;; WHEN: Fri Aug 10 07:45:02 2007
;; MSG SIZE  rcvd: 436



/etc/cron.monthly/NAMED_ROOT_SERVERS_LIST_REFRESH:
==============================================================================
#!/bin/sh
# Tous les mois, on va aller rechercher le listing des ROOT.SERVERS
# afin qu'il soit TJRS à jour.
# Info par e-mail
(
echo "From: ns2@smtp.defcon1"
echo "To: root@smtp.defcon1"
echo "Subject: NS2 - Automatic update of file: /etc/bind/db.root"

# query NS.ROOT SERVER
cd /etc/bind
dig @a.root-servers.net. . ns >/etc/bind/db.root.new

J'suis bon pour un man dig


echo "BIND9: Update de named.root"
echo
cat db.root.new

# remplacement du fichier
chown root.root db.root.new
chmod 444 db.root.new
if [ -e /etc/bind/db.root.old ]
then
    rm -f db.root.old
fi
mv db.root db.root.old
mv db.root.new db.root

# recharger named pour MAJ
/etc/init.d/bind9 reload
echo
echo "Le DNS a été relancé afin que l'update soit effectif."
echo "Le précédent fichier /etc/bind/db.root s'appelle maintenant /etc/bind/db.root.old."
) 2>&1 | /usr/lib/sendmail -t
exit 0



=======================================================================



Voila, en espérant que ça pourra aider, parce qu'il est vrai que quand
on plonge dans bind, on trouve à boire et à manger :(

JYB



Reply to: