Benutzer-Werkzeuge

Webseiten-Werkzeuge


bind9

Bind9 ist ein DNS Nameserver für Linux. Oft auch named genannt.

# IPv6 Auflösungen verhindern
filter-aaaa-on-v4 yes;

Installation

Debian

Bringen Sie Ihr System auf den neuesten Stand und installieren Sie Bind9:

apt update
apt install bind9

Die Konfiguration befindet sich unter:

/etc/bind/

RHEL

Bind installieren:

dnf install bind -y

Die Hauptkonfiguration befindet sich unter:

/etc/named.conf

Zonendateien liegen unter:

/var/named/

Konfiguration

Debian

Im Verzeichnis /etc/bind/ befinden sich z.B.:

db.0               db.local       named.conf
db.127             db.root        named.conf.local
db.255             db.empty       named.conf.options
zones.rfc1918      rndc.key
  • named.conf – globale Konfiguration
  • named.conf.local – eigene Zonen hinzufügen
  • named.conf.options – DNS-Optionen (Forwarder, Recursion, Logging)
  • db.* – Zonendateien

RHEL

  • /etc/named.conf – globale Konfiguration
  • /var/named/ – Zonendateien (Master/Slave)

Beispielinhalt von /var/named:

data  dynamic  named.ca  named.empty  named.localhost  named.loopback  slaves

Eigene Zonendateien werden i.d.R. nach dem Muster domain.tld.db benannt.

Zones

Forward Lookup Zone

$TTL 2D
@       IN      SOA     example.local. admin.example.local. (
                        2025053001  ; Serial
                        28800       ; Refresh
                        7200        ; Retry
                        2419200     ; Expire
                        10800 )     ; Negative Cache TTL

@       IN      NS      ns.example.local.
@       IN      A       192.168.1.10

ns      IN      A       192.168.1.10
www     IN      A       192.168.1.10

Wichtig: Am Ende der Datei muss eine Leerzeile sein!

Debian

In /etc/bind/named.conf.local:

zone "example.local" IN {
    type master;
    file "/etc/bind/db.example.local";
    allow-update { none; };
};

Zonendatei erstellen: /etc/bind/db.example.local

RHEL

In /etc/named.conf (oder in eine separate Datei und per include einbinden):

zone "example.local" IN { type master; file "/var/named/example.local.db"; allow-update { none; }; };

Zonendatei erstellen: /var/named/example.local.db

Reverse Lookup Zone

Reverse Zone trägt IPs rückwärts ein.

  • Beispiel: IP 192.168.1.10/24
  • Zonendateiname enthält die ersten 3 Oktette rückwärts: 1.168.192.in-addr.arpa
$TTL 2D
@       IN      SOA     example.local. admin.example.local. (
                        2025053002  ; Serial
                        8H
                        2H
                        4W
                        2D )

@       IN      NS      ns.example.local.

10      IN      PTR     example.local.
10      IN      PTR     www.example.local.

Debian

In /etc/bind/named.conf.local:

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

Datei: /etc/bind/db.192.168.1

RHEL

In /etc/named.conf:

zone "1.168.192.in-addr.arpa" IN {
    type master;
    file "/var/named/192.168.1.db";
};

Datei: /var/named/192.168.1.db

Logging

Debian

In /etc/bind/named.conf.options

logging {
    channel queries_log {
        file "/var/cache/bind/queries.log" versions 10 size 20m;
        print-time yes;
        print-category yes;
        print-severity yes;
        severity info;
    };

    category queries {
        queries_log;
    };
};
touch /var/cache/bind/queries.log
chown bind:bind /var/cache/bind/queries.log

RHEL

In /etc/named.conf

logging {
    channel queries_log {
        file "/var/cache/bind/queries.log" versions 10 size 20m;
        print-time yes;
        print-category yes;
        print-severity yes;
        severity info;
    };

    category queries {
        queries_log;
    };
};

Empfohlen: /var/named/data/queries.log

touch /var/named/data/queries.log
chown named:named /var/named/data/queries.log
bind9.txt · Zuletzt geändert: 2025/11/12 18:56 (Externe Bearbeitung)