Zum Hauptinhalt springen

Tag 3: BIND DNS

1 BIND9 - DNS-Server​

BIND (Dienst heisst named) ist ein Open-Source DNS-Server. Als Alternative gibt es den DNS-Server Dnsmasq.

1.1 Installation​

Um BIND und alle dazubenötigten Packages zu installieren, kann folgender Befehl genutzt werden:

sudo apt install bind9 bind9utils bind9-doc
  • bind9 -> Die eigentliche Software
  • bind9utils -> Hilfsprogramme
  • bind9-doc -> Dokumentation zur Software

1.2 Bedienung​

Als erstes muss der Dienst zum Autostart hinzugefĂĽgt werden:

sudo systemctl enable named

Dienste steuern

1.3 Konfiguration​

BIND hat vier Config-Dateien:

/etc/bind/named.conf.options
Enthält die Konfigurationsoptionen. Was soll der Server machen, wenn er die DNS-Anfrage nicht beantworten kann.

/etc/bind/named.conf.local
In dieser Datei werden die Zonendatein eingebunden.

/etc/bind/db.DOMAIN.CH.zone
Forward-Zonendatei. Hier werden alle Einträge erfasst welche von Namen zu IP aufgelöst werden sollen. Der Name der Datei kann frei wählbar sein. Es macht allerdings Sinn, wenn man sie erkennbar benennt, z.B. *.zone

/etc/bind/db.0.0.0.10
Reverse-Zonendatei. Wie bei der Forward-Zone werden hier Einträge erfasst, allerdings die Anfragen die von IP zu Namen übersetzt werden sollen.

BIND Dateien

1.3.1 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 {
8.8.8.8;
4.4.4.4;
};

//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation no;

recursion yes;

querylog yes;

auth-nxdomain no;

listen-on-v6 { any; };
};

1.3.2 Forward-Zone​

;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA bind.PANICOlocal.ch. root.PANICOlocal.ch. (
2022020401 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS bind ; Nameserver-Eintrag. Wir selber.
@ IN A 10.0.0.200 ; Unsere IP

; A-Einträge

bind IN A 10.0.0.200
apache IN A 10.0.0.100

1.3.3 Reverse-Zone​

;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA bind.PANICOlocal.ch. root.PANICOlocal.ch. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS bind.PANICOlocal.ch. ; NS Eintrag

; PTR Einträge
200 IN PTR bind.PANICOlocal.ch. ; Dieser Server
100 IN PTR apache.PANICOlocal.ch. ; Apache WWW Server

1.3.4 Local - Zonen einbinden​

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

# Forward Zone
zone "panicolocal.ch" {
type master;
file "/etc/bind/PANICOlocal.ch.zone";
};

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

Quellen: Beschreibung BIND