Bind, Reverse-Records auf Subnetzen definieren

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
Cae
Beiträge: 6349
Registriert: 17.07.2011 23:36:39
Wohnort: 2130706433

Bind, Reverse-Records auf Subnetzen definieren

Beitrag von Cae » 01.02.2012 23:30:58

Hallo zusammen,

ich würde gerne ein paar Rechner und VMs im DNS auch rückwärts auflösbar machen. Im Einsatz ist der Bind unter Squeeze. Problem scheint zu sein, dass sie in unterschiedlichen Subnetzen liegen. Ich versuche das mal mit example.org und dem 10.1.0.0/16-er Netz nachzukonstruieren:

Ausschnitt, /etc/bind/named.conf.local:

Code: Alles auswählen

zone "vm.example.org." {
    type master;
    file "/var/cache/bind/db.vm.example.org";
};

zone "1.10.in-addr.arpa." in {
    type master;
    file "/var/cache/bind/db.ptr.vm.example.org";
};
Die Symlinks liegen in /var, um Updates über DHCP einspielen zu können (hier nicht im Einsatz).

/etc/bind/db.vm.example.org

Code: Alles auswählen

$ORIGIN vm.example.org.
$TTL    21600
@   IN  SOA ns1.vm.example.org. root.ns1.vm.example.org. (
                  1     ; Serial
               3600     ; Refresh
                180     ; Retry
             604800     ; Expire
               3600 )   ; Negative Cache TTL
        NS  ns1.vm.example.org.
        A   10.1.1.1
;
test0    A   10.1.1.1
test1    A   10.1.2.1
/etc/bind/db.ptr.vm.example.org

Code: Alles auswählen

$TTL    21600   ; 6 hours
$ORIGIN 1.10.IN-ADDR.ARPA.
@   IN  SOA ns1.vm.example.org. root.ns1.vm.example.org. (
                69         ; serial
                3600       ; refresh (1 hour)
                180        ; retry (3 minutes)
                604800     ; expire (1 week)
                3600       ; minimum (1 hour)
                )   
            NS  ns1.vm.example.org.
; erstes Subnetz
.1.1            PTR test0.vm.example.org.
; zweites Subnetz
.1.2            PTR test1.vm.example.org.
Dann wirft Bind allerdings diese Zeile in's syslog:

Code: Alles auswählen

zone 1.10.in-addr.arpa/IN: loading from master file /var/cache/bind/db.ptr.vm.example.org failed: empty label
Wie macht man das richtig?
Für jedes Subnetz einen eigenen $ORIGIN? Ohne Punkt? vims syntax highlighting macht es rot und im syslog steht

Code: Alles auswählen

/var/cache/bind/db.ptr.example.org:14: ignoring out-of-zone data (1.2.1.10.in-addr.arpa)
Mit anderen Trennern?

Gruß Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.

—Bruce Schneier

Benutzeravatar
habakug
Moderator
Beiträge: 4314
Registriert: 23.10.2004 13:08:41
Lizenz eigener Beiträge: MIT Lizenz

Re: Bind, Reverse-Records auf Subnetzen definieren

Beitrag von habakug » 02.02.2012 01:28:19

Hallo!

Du brauchst jeweils eine Zonendatendatei und eine zone-Anweisung pro Zone, sonst wird sie ignoriert (ignoring out-of-zone data). Er nennt die Zone auch (1.2.1.10.in-addr.arpa).

Gruß, habakug
( # = root | $ = user | !! = mod ) (Vor der PN) (Debianforum-Wiki) (NoPaste)

Benutzeravatar
ThorstenS
Beiträge: 2875
Registriert: 24.04.2004 15:33:31

Re: Bind, Reverse-Records auf Subnetzen definieren

Beitrag von ThorstenS » 02.02.2012 07:27:28

Ausschnitt aus der /etc/bind/named.conf.local

Code: Alles auswählen

// 10.in-addr.arpa
zone "10.in-addr.arpa" IN {
        type master;
        file "db.10";
};

// VPN.DOMAIN.TLD
zone "vpn.domain.tld" IN {
        type master;
        file "db.vpn.domain.tld";
};

// vim: set ts=8 ft=cfg syntax=on:
meine db.vpn.domain.tld

Code: Alles auswählen

$TTL 1D
$ORIGIN vpn.domain.tld.
@              IN SOA ns0.domain.tld. dns.domain.tld. (
               2012012704      ; serial (YYYYMMDDXX)
               1D              ; refresh
               1H              ; retry
               1W              ; expiry
               1D )            ; minimum TTL

; NS
               IN NS           ns0.domain.tld.

; MX
@              IN MX 50        mx0.domain.tld.

; Beispiel IP - nicht meine
@              IN A            88.66.77.55

; spinne
spinne         IN A            192.168.1.2


morgen         IN A            10.20.0.1
mittag         IN A            10.21.0.1
abend          IN A            10.25.0.1
Meine /etc/bind/db.10

Code: Alles auswählen

$TTL 1D
$ORIGIN 10.in-addr.arpa.
@   IN SOA ns0.domain.tld. dns.domain.tld. (
        2012012704  ; serial (YYYYMMDDXX)
        1D    ; refresh
        1H    ; retry
        1W    ; expiry
        1D )    ; minimum TTL

; NS
    IN NS   ns0.domain.tld.

; 10.20.0.1
1.0.20  IN PTR  morgen.vpn.domain.tld.
; 10.21.0.1
1.0.21  IN PTR  mittag.vpn.domain.tld.
; 10.25.0.1
1.0.25  IN PTR  abend.vpn.domain.tld.
und zur Vollständigkeit meine /etc/bind/named.conf.options

Code: Alles auswählen

options {
  // Die db-files liegen in /etc/bind/
  directory "/etc/bind";

  // Bei Fehlern in den master files nur warn
  check-names master warn;

  // Neue Methode für Zonen-Transfer
  transfer-format many-answers;

  // Niemand darf unsere Zonen transferieren
  allow-transfer {none;};

  // Alle dürfen uns abfragen
  allow-query {any;};

  // Grösse der Journals (für IXFR) limitieren (auf 32kB)
  max-journal-size 32k;

  // conform to RFC1035
  auth-nxdomain no;

  // XXX
  listen-on-v6 { none; };

  // Statistiken (u.a. für munin)
  statistics-file "/var/run/named/stats";
};

Cae
Beiträge: 6349
Registriert: 17.07.2011 23:36:39
Wohnort: 2130706433

Re: Bind, Reverse-Records auf Subnetzen definieren

Beitrag von Cae » 02.02.2012 10:48:33

ThorstenS hat geschrieben:Meine /etc/bind/db.10

Code: Alles auswählen

$ORIGIN 10.in-addr.arpa.
--schnipp
1.0.20  IN PTR  morgen.vpn.domain.tld.
Daraus leite ich mal ab: in-addr.arpa. möglicherweise nur in lowecase (komisch, alle anderen Dateien haben es), IN-Klasse eintragen und ohne Punkt vorne. Danke, dann probiere ich das heute abend aus.

Die Aufsplittung in verschiedene Zonendateien wollte ich eigentlich vermeiden. Das ist schon so chaotisch genug.

Gruß Cae
If universal surveillance were the answer, lots of us would have moved to the former East Germany. If surveillance cameras were the answer, camera-happy London, with something like 500,000 of them at a cost of $700 million, would be the safest city on the planet.

—Bruce Schneier

Antworten