Benutzer-Werkzeuge

Webseiten-Werkzeuge


tachtler:dns_isc_bind_centos_5

DNS ISC bind CentOS 5

DNS ISC bind ist ein DNS-Server, welcher die Namensauflösung in einem Netzwerk realisieren kann. Der DNS-Server des ISC (Internet System Consortium) ist einer der meist eingesetzten Namensserver weltweit und ebenfalls der bei den aktuell 13 weltweiten Root-Nameservern verwendete DNS-Server.

:!: Hinweis - Die nachfolgenden Ausführungen erheben keinen Anspruch auf Vollständigkeit, sondern stellen eine „Basiskonfiguration“ eins DNS-Servers für ein kleines privates Netzwerk dar!!!

Ab hier werden zur Ausführung nachfolgender Befehle root-Rechte benötigt. Um der Benutzer root zu werden, melden Sie sich bitte als root-Benutzer am System an, oder wechseln mit nachfolgendem Befehl zum Benutzer root:

$ su -
Password:

Installation

Folgende Pakete werden benötigt, wenn ein „lokalen DNS-Server“ betrieben werden soll:

  • bind (bind.i386) –> eigentlicher Dienst (Daemon) mit Namen named
  • caching-nameserver (caching-nameserver.i386) –> Konfigurationsdateien (unter CentOS)

und optional zur grafischen Konfiguration unter einem X-Server (z.B. hier gnome)

  • system-config-bind (system-config-bind.noarch) –> (unter CentOS)

Konfiguration

Konfigurationsdatei "/etc/resolv.conf"

Die hier beschriebene Konfiguration stellt eine kleines Heimnetzwerk dar, welches aus folgenden Komponenten besteht

  • Rechner mit der IP-Adresse 192.168.0.1 (soll der Master-DNS-Server sein) –> nss.tachtler.net
  • Rechner mit der IP-Adresse 192.168.0.2 (soll ein Client-Rechner sein)–> rechner1.tachtler.net

Als erstes muss eine evtl. bestehende Konfiguration der Datei /etc/resolv.conf auf dem Rechner nss.tachtler.net angepasst werden. Hier sind evtl. schon Einträge vorhanden, welche auch z.B. vom Programm NetworkManager unter (gnome) erstellt wurden. Bei laufendem Programm NetworkManager unter (gnome) müssen ein paar Dinge beachtet werden..

Die Datei /etc/resolv.conf auf dem PC nss.tachtler.net sollte folgenden Inhalt haben:

search tachtler.net
 
nameserver 192.168.0.1
nameserver <ns1 des Providers>
nameserver <ns2 des Providers>

Konfigurationsdatei "/etc/dhclient-ethX.conf"

Hier steht das „X“ im Namen von /etc/dhclient-ethX.conf für die einzelnen Netzwerkkarten z.B. eth0 wäre dann /etc/dhclient-eth0.conf.

:!: Falls der NetworkManager genutzt wird, ist ein direktes editieren der Datei /etc/resolv.conf zwecklos, da die Einstellungen vom NetworkManager überwacht werden und ggf. immer wieder überschriebenen werden.

Aufgrund dieser Tatsache, ist es notwendig zwei Konfigurationszeilen in die Datei z.B. /etc/dhclient-eth0.conf einzutragen und für jede weitere Netzwerkkarte des Rechners ebenfalls (hier die beiden ersten Zeilen)

Hier auf den Rechner nss.tachtler.net

   prepend domain-name-servers 192.168.0.1, 12.34.56.78, 12.34.56.79;
   supersede domain-name "tachtler.net";
   send host-name "nss.tachtler.net";

Dies ist ebenfalls auf jedem weiteren Rechner im Netzwerk zu definieren, hier auf z.B. rechner1.tachtler.net

   prepend domain-name-servers 192.168.0.1, 12.34.56.78, 12.34.56.90;
   supersede domain-name "tachtler.net";
   send host-name "rechner1.tachtler.net";

:!: WICHTIG! ist, dass immer wenn der NetworkManager im Einsatz ist, in den Konfigurationsdateien /etc/dhclient-ethX.conf (wobei das „X“ für z.B. die Nummer der Netzwerkkarte steht) immer der DNS-Server als erstes eingetragen wird, der KEINE lokale Adresse hat, weil die Konfigurationsdateien /etc/dhclient-ethX.conf immer nur dann angezogen werden, wenn KEIN lokaler DNS-Server läuft, sprich auf dem lokalen Rechner der Dienst (Daemon) named NICHT gestartet ist!

Konfigurationsdatei "/etc/named.conf" einfach

Falls nicht vorhanden (was der Fall sein dürfte), kann eine Vorlagendatei von ./usr/share/system-config-bind/profiles/default/named.conf in das Verzeichnis /etc/named.conf kopiert werden. Der Befehl dafür lautet:

   # cp /usr/share/system-config-bind/profiles/default/named.conf /etc/named.conf

Der Inhalt der Konfigurationsdatei /etc/named.conf könnte danach wie folgt aussieht:

//
// /etc/named.conf
//
// BIND Configuration.
//
 
acl masters {
        127.0.0.1;
        192.168.0.1;
};
 
options {
        directory "/var/named";
        pid-file "/var/run/named/named.pid";
        dump-file "data/cache_dump.db";
        statistics-file "data/named_stats.txt";
        memstatistics-file "data/named_mem_stats.txt";
        /*
         * DNS-Server which will asked when local answers not found.
         * With problems while censorship with ISP no forwards will
         * be defined.
         *
         * forwarders { 212.18.3.5; 212.18.0.5; };
         */
        /*
         * Route the questions only to the DNS-Server, specified at
         * "forwarders" statement, when zone not match.
         * With problems while censorship with ISP no forwards will
         * be defined and Option forward will be changed to "only".
         *
         * forward first;
         */
        forward only;
        // No notification form this DNS-Server to anyone.
        notify no;
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        query-source address * port *;
        // No answer, when asking for bind-version.
        version "";
        // Accept no old questions and configurations.
        auth-nxdomain no;
        // Allow these HOSTs to ask ordinary DNS questions.
        allow-query { 127.0.0.1/8; 192.168.0.0/24; };
        // Allow these HOSTs to ask recursiv DNS questions.
        allow-recursion { 127.0.0.1/8; 192.168.0.0/24; };
        // The HOSTs which will get answers for queries.
        listen-on { 127.0.0.1/8; 192.168.0.0/24; };
        // Enable zonetransfer to these HOSTs.
        allow-transfer { masters; };
        // Local address for zone transfers.
        transfer-source 192.168.0.1;
};
 
logging {
        channel syslog {
                syslog syslog;
                severity info;
        };
};
 
include "/etc/named.rfc1912.zones";
 
zone "tachtler.net" IN {
        type master;
        file "masters/tachtler.net";
        allow-update { none; };
};
 
zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "masters/0.168.192.in-addr.arpa";
        allow-update { none; };
};
 
/*
* Zone with static and official IP-Address.
*/
zone "167.171.217.88.in-addr.arpa" IN {
        type master;
        file "masters/167.171.217.88.in-addr.arpa";
        allow-update { none; };
};
 
include "/etc/rndc.tachtler.net.key";
 
controls {
      inet 127.0.0.1 port 953
              allow { localhost; masters; } keys { rndc.tachtler.net; };
};

Konfigurationsdatei "/etc/named.conf" views

Eine weitere Möglichkeit die Konfigurationsdatei /etc/named.conf zu gestalten ist der Einsatz von Views.

Views werden gerne dazu benutzt gewisse Sichten von IP-Adressen im z.B.

  • internen Netzwerk
  • externen Internet

zu realisieren.

Hierbei kommen meist unterschiedliche Zonen-Dateien, je nach Sicht für das interne Netzwerk, oder das externe Internet zum Einsatz.

:!: WICHTIG - Im folgenden Beispiel, ist IMMER nur die Rede von einem lokalen DNS-Server, welcher NICHT vom Internet aus erreichbar ist!

Dieses Beispiel zeigt eine Sicht View für die

  • interne Netzwerkadressen 127.0.0.1/8
  • externe Netzwerkadressen 192.168.0.1/24

wobei die Zonen-Dateien NICHT unterschiedlich sind!

//
// /etc/named.conf
//
// BIND Configuration.
//
 
acl masters {
        127.0.0.1;
        192.168.0.1;
};
 
options {
        directory "/var/named";
        pid-file "/var/run/named/named.pid";
        dump-file "data/cache_dump.db";
        statistics-file "data/named_stats.txt";
        memstatistics-file "data/named_mem_stats.txt";
        /*
         * DNS-Server which will asked when local answers not found.
         * With problems while censorship with ISP no forwards will
         * be defined.
         *
         * forwarders { 212.18.3.5; 212.18.0.5; };
         */
        /*
         * Route the questions only to the DNS-Server, specified at
         * "forwarders" statement, when zone not match.
         * With problems while censorship with ISP no forwards will
         * be defined and Option forward will be changed to "only".
         *
         * forward first;
         */
        forward only;
        // No notification form this DNS-Server to anyone.
        notify no;
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        query-source address * port *;
        // No answer, when asking for bind-version.
        version "";
        // Accept no old questions and configurations.
        auth-nxdomain no;
        // Allow these HOSTs to ask ordinary DNS questions.
        allow-query { 127.0.0.1/8; 192.168.0.0/24; };
        // Allow these HOSTs to ask recursiv DNS questions.
        allow-recursion { 127.0.0.1/8; 192.168.0.0/24; };
        // The HOSTs which will get answers for queries.
        listen-on { 127.0.0.1/8; 192.168.0.0/24; };
        // Enable zonetransfer to these HOSTs.
        allow-transfer { masters; };
        // Local address for zone transfers.
        transfer-source 192.168.0.1;
};
 
logging {
        channel syslog {
                syslog syslog;
                severity info;
        };
};
 
//
// This view sets up named to be a localhost resolver ( caching only nameserver ).
//
 
view "localhost_resolver" {
        match-clients           { 127.0.0.1/8; };
        match-destinations      { 127.0.0.1/8; };
        recursion yes;
 
        /* all views must contain the root hints zone:
         * exists with update bind-9.3.4-6.0.3.P1.el5_2 in
         * /etc/named.rfc1912.zones
         */
        // include "/etc/named.root.hints";
 
        /* these are zones that contain definitions for all the localhost
         * names and addresses, as recommended in RFC1912 - these names should
         * ONLY be served to localhost clients:
         */
        include "/etc/named.rfc1912.zones";
 
        // these zone are served as answer for forward requests to 127.0.0.1/8.
        zone "tachtler.net" IN {
                type master;
                file "masters/tachtler.net";
 
                /* Allow update to these HOSTs. (example nsupdate).
                 * A zone can be updated either by editing zone files and
                 * reloading the server or by dynamic update, but not both.
                 * If you have enabled dynamic update for a zone using the
                 * "allow-update" option, you are not supposed to edit the
                 * zone file by hand, and the server will not attempt to
                 * reload it.
                 * If enabled, the following statement could not be used!
                 * rndc reload tachtler.net IN localhost_resolver
                 */
                // allow-update { key rndc.tachtler.net; };
        };
 
        // these zone are served as answer for reverse requests to 127.0.0.1/8.
        zone "0.168.192.in-addr.arpa" IN {
                type master;
                file "masters/0.168.192.in-addr.arpa";
 
                /* Allow update to these HOSTs. (example nsupdate).
                 * A zone can be updated either by editing zone files and
                 * reloading the server or by dynamic update, but not both.
                 * If you have enabled dynamic update for a zone using the
                 * "allow-update" option, you are not supposed to edit the
                 * zone file by hand, and the server will not attempt to
                 * reload it.
                 * If enabled, the following statement could not be used!
                 * rndc reload 0.168.192.in-addr.arpa IN localhost_resolver
                 */
                // allow-update { key rndc.tachtler.net; };
        };
 
        // these zone are served as answer for reverse requests to 88.217.171.167/32.
        zone "167.171.217.88.in-addr.arpa" IN {
                type master;
                file "masters/167.171.217.88.in-addr.arpa";
 
                /* Allow update to these HOSTs. (example nsupdate).
                 * A zone can be updated either by editing zone files and
                 * reloading the server or by dynamic update, but not both.
                 * If you have enabled dynamic update for a zone using the
                 * "allow-update" option, you are not supposed to edit the
                 * zone file by hand, and the server will not attempt to
                 * reload it.
                 * If enabled, the following statement could not be used!
                 * rndc reload 167.171.217.88.in-addr.arpa IN localhost_resolver
                 */
                // allow-update { key rndc.tachtler.net; };
        };
};
 
//
// This view sets up named to be serve tachtler.net for local network.
//
view "tachtler.net" {
        match-clients           { 192.168.0.0/24; };
        match-destinations      { 192.168.0.0/24; };
        recursion yes;
 
        /* all views must contain the root hints zone:
         * exists with update bind-9.3.4-6.0.3.P1.el5_2 in
         * /etc/named.rfc1912.zones
         */
        // include "/etc/named.root.hints";
 
        /* these are zones that contain definitions for all the localhost
         * names and addresses, as recommended in RFC1912 - these names should
         * ONLY be served to localhost clients:
         */
        include "/etc/named.rfc1912.zones";
 
        // these zone are served as answer for forward requests to 192.168.0.0/24.
        zone "tachtler.net" IN {
                type master;
                file "masters/tachtler.net";
 
                /* Allow update to these HOSTs. (example nsupdate).
                 * A zone can be updated either by editing zone files and
                 * reloading the server or by dynamic update, but not both.
                 * If you have enabled dynamic update for a zone using the
                 * "allow-update" option, you are not supposed to edit the
                 * zone file by hand, and the server will not attempt to
                 * reload it.
                 * If enabled, the following statement could not be used!
                 * rndc reload tachtler.net IN tachtler.net
                 */
                // allow-update { key rndc.tachtler.net; };
        };
 
        // these zone are served as answer for reverse requests to 192.168.0.0/24.
        zone "0.168.192.in-addr.arpa" IN {
                type master;
                file "masters/0.168.192.in-addr.arpa";
 
                /* Allow update to these HOSTs. (example nsupdate).
                 * A zone can be updated either by editing zone files and
                 * reloading the server or by dynamic update, but not both.
                 * If you have enabled dynamic update for a zone using the
                 * "allow-update" option, you are not supposed to edit the
                 * zone file by hand, and the server will not attempt to
                 * reload it.
                 * If enabled, the following statement could not be used!
                 * rndc reload 0.168.192.in-addr.arpa IN tachtler.net
                 */
                // allow-update { key rndc.tachtler.net; };
        };
 
        // these zone are served as answer for reverse requests to 88.217.171.167/32.
        zone "167.171.217.88.in-addr.arpa" IN {
                type master;
                file "masters/167.171.217.88.in-addr.arpa";
 
                /* Allow update to these HOSTs. (example nsupdate).
                 * A zone can be updated either by editing zone files and
                 * reloading the server or by dynamic update, but not both.
                 * If you have enabled dynamic update for a zone using the
                 * "allow-update" option, you are not supposed to edit the
                 * zone file by hand, and the server will not attempt to
                 * reload it.
                 * If enabled, the following statement could not be used!
                 * rndc reload 167.171.217.88.in-addr.arpa IN tachtler.net
                 */
                // allow-update { key rndc.tachtler.net; };
        };
};
 
include "/etc/rndc.tachtler.net.key";
 
controls {
      inet 127.0.0.1 port 953
              allow { localhost; masters; } keys { rndc.tachtler.net; };
};

Konfigurationsdatei "/etc/named.rfc1912.zones"

Die Konfigurationsdatei /etc/named.rfc1912.zones ist bereist Bestandteil der Installation von BIND.

Der Inhalt der Datei sollte wie folgt aussehen:

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
        type hint;
        file "named.ca";
};
 
zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};
 
zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};
 
zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};
 
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};
 
zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};
 
zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};

:!: WICHTIG - Alle hier definierten Zonen-Dateien befinden sich unter

  • /var/named

welche mit nachfolgendem Befehl aufgelistet werden können:

# ll /var/named
total 56
drwxrwx--- 2 named named 4096 Aug 25  2004 data
-rw-r----- 1 root  named  198 Nov 10  2007 localdomain.zone
-rw-r----- 1 root  named  195 Nov 10  2007 localhost.zone
drwxr-x--- 2 root  named 4096 Apr 24 23:03 masters
-rw-r----- 1 root  named  427 Nov 10  2007 named.broadcast
-rw-r----- 1 root  named 1892 Jan 21 13:27 named.ca
-rw-r----- 1 root  named  424 Nov 10  2007 named.ip6.local
-rw-r----- 1 root  named  426 Nov 10  2007 named.local
-rw-r----- 1 root  named  427 Nov 10  2007 named.zero

Eigene Zonen-Dateien "/var/named/masters"

Die eigenen Zonen-Dateien sind hier im Verzeichnis /var/named/masters untergebracht.

Folgende Dateien sind im Verzeichnis /var/named/masters enthalten und könneen mit nachfolgendem Befehl aufgelistet werden:

# ll /var/named/masters
total 24
-rw-r----- 1 root named 496 Feb  2 16:43 0.168.192.in-addr.arpa
-rw-r----- 1 root named 237 Feb  2 16:43 167.171.217.88.in-addr.arpa
-rw-r----- 1 root named 911 Feb  2 16:43 tachtler.net

Der Inhalt der einzelnen Dateien sieht wie folgt aus.

Zonen-Datei "tachtler.net" (Forward)

$TTL    86400
@                                       IN  SOA ns.tachtler.net.        root.nss.tachtler.net. (
                                                2009020201      ; serial
                                                3H              ; refresh
                                                15M             ; retry
                                                1W              ; expiry
                                                1D )            ; minimum
 
                                        IN  NS  ns.tachtler.net.
 
                                        IN  MX 10       mx1.tachtler.net.
                                        IN  MX 20       mx1.nausch.org.
 
localhost                               IN  A   127.0.0.1
 
mx1.tachtler.net.                       IN  A   88.217.171.167
 
tachtler.net.                           IN  A   88.217.171.167
                                        IN  TXT "v=spf1 mx ?all"
*.tachtler.net.                         IN  A   88.217.171.167
                                        IN  TXT "v=spf1 mx ?all"
 
ns                                      IN  A   192.168.0.1
nss                                     IN  A   192.168.0.1
 
rechner1                                IN  A   192.168.0.3

Zonen-Datei "0.168.192.in-addr.arpa" (Reverse)

$TTL    86400
@                                       IN  SOA ns.tachtler.net.        root.nss.tachtler.net. (
                                                2009020201      ; serial
                                                3H              ; refresh
                                                15M             ; retry
                                                1W              ; expiry
                                                1D )            ; minimum
 
                                        IN  NS  ns.tachtler.net.
 
1                                       IN  PTR nss.tachtler.net.
 
3                                       IN  PTR rechner1.tachtler.net.

Zonen-Datei "167.171.217.88.in-addr.arpa" (Reverse)

$TTL    86400
@                                       IN  SOA ns.tachtler.net.        root.nss.tachtler.net. (
                                                2009020201      ; serial
                                                3H              ; refresh
                                                15M             ; retry
                                                1W              ; expiry
                                                1D )            ; minimum
 
                                        IN  NS  ns.tachtler.net.
 
                                        IN  PTR mx1.tachtler.net.

Konfigurationsdatei "/etc/rndc.conf"

Die Konfigurationsdatei /etc/rndc.conf beinhaltet die Informationen über benötigte

  • Schlüssel (hier nur ein Schlüssel für alle Server)
  • Server für welche die Schlüssel Gültigkeit haben
  • Optionen, wie die Schlüssel angewandt werden
# Start of rndc.conf
include "/etc/rndc.tachtler.net.key";
 
server 127.0.0.1 {
        key "rndc.tachtler.net";
};
 
server 192.168.0.1 {
        key "rndc.tachtler.net";
};
 
options {
        default-key "rndc.tachtler.net";
        default-server 127.0.0.1;
        default-port 953;
};

Schlüsseldatei "/etc/rndc.tachtler.net.key"

Die Schlüsseldatei /etc/rndc.tachtler.net.key enthält den Schlüssel für die entsprechenden Server in denen dieser Schlüssel eingesetzt wird. (Hier sind dies ALLE Server):

key "rndc.tachtler.net" {
        algorithm       hmac-md5;
        secret          "cD91E3ieJaXVPakU1Z6EGGH1Db2czopBQq4P3eDZ2LE8A31abc021MykgXLS";
};

Konfiguration als "chroot"

Grundsätzlich ist an den bereits erstellten Konfigurationsdateien für einen DNS-Server nichts zu ändern, nur weil die DNS-Server nun in einer eignen Umgebung /var/named/chroot und nicht mehr unter den Rechten root, sondern unter den von named laufen soll. Es sind allerdings einige Dinge zu beachten, was die Einrichtung betrifft.

Installation "chroot"

Bevor mit der Einrichtung des DNS-Server begonnen werden kann, ist folgendes Paket zu installieren:

  • bind-chroot (bind-chroot.i386)

Nach der Installation ergeben sich folgende Änderungen im Dateisystem:

# ll /etc/named.*
lrwxrwxrwx 1 root named 52 Apr  1 22:32 /etc/named.caching-nameserver.conf -> /var/named/chroot//etc/named.caching-nameserver.conf
lrwxrwxrwx 1 root root  33 Apr  2 00:54 /etc/named.conf -> /var/named/chroot//etc/named.conf
lrwxrwxrwx 1 root named 42 Apr  1 22:32 /etc/named.rfc1912.zones -> /var/named/chroot//etc/named.rfc1912.zones
# ll /etc/rndc.*
lrwxrwxrwx 1 root named 31 Apr 25  2008 /etc/rndc.conf -> /var/named/chroot/etc/rndc.conf
lrwxrwxrwx 1 root named 43 Oct 15  2008 /etc/rndc.tachtler.net.key -> /var/named/chroot/etc/rndc.tachtler.net.key

Falls der Schlüssel (in deisem Fall /etc/rndc.tachtler.net.key) sich im Verzeichnis /etc befindet, muss dieser ebenfalls verschoben werden und mit einer Verknüpfung (symbolischer Link) versehen werden. Dies ist mit nachfolgenden Befehlen realisierbar.

# mv /etc/rndc.tachtler.net.key /var/named/chroot/etc

Einen symbolischen Link wird mit folgendem Befehl erstellt:

# ln -s /var/named/chroot/etc/rndc.tachtler.net.key /etc/rndc.tachtler.net.key

Danach muss noch den Benutzer und die Gruppe für den symbolischen Link, nicht für die dahinterliegende Datei geändert werden, dafür ist folgenden Befehl zuständig:

# chown -h root:named /etc/rndc.tachtler.net.key

Das Ergebnis sollte dann z.B. so aussehen, was mit nachfolgendem Befehl überprüft werden kann:

# ll /var/named/chroot/etc/
total 60
-rw-r--r-- 1 root root  2309 Sep 16  2008 localtime
-rw-r----- 1 root named 1195 Jul 12  2008 named.caching-nameserver.conf
-rw-r--r-- 1 root named 7697 Apr 24 23:31 named.conf
-rw-r----- 1 root named  955 Jan  9 03:40 named.rfc1912.zones
-rw-r--r-- 1 root named  289 Oct 15  2008 rndc.conf
-rw-r--r-- 1 root named  123 Oct 15  2008 rndc.tachtler.net.key

Im Verzeichnis /etc/named haben sich auch einige äÄnderungen ergeben, welche mit folgendem Befehl zu sehen sind:

]# ll /var/named/
total 4
drwxr-x--- 6 root  named 4096 Jan 21 13:27 chroot
lrwxrwxrwx 1 named named   32 Apr 25  2008 data -> /var/named/chroot/var/named/data
lrwxrwxrwx 1 root  named   45 Apr  1 22:32 localdomain.zone -> /var/named/chroot//var/named/localdomain.zone
lrwxrwxrwx 1 root  named   43 Apr  1 22:32 localhost.zone -> /var/named/chroot//var/named/localhost.zone
lrwxrwxrwx 1 root  named   35 Apr 25  2008 masters -> /var/named/chroot/var/named/masters
lrwxrwxrwx 1 root  named   44 Apr  1 22:32 named.broadcast -> /var/named/chroot//var/named/named.broadcast
lrwxrwxrwx 1 root  named   37 Apr  1 22:32 named.ca -> /var/named/chroot//var/named/named.ca
lrwxrwxrwx 1 root  named   44 Apr  1 22:32 named.ip6.local -> /var/named/chroot//var/named/named.ip6.local
lrwxrwxrwx 1 root  named   40 Apr  1 22:32 named.local -> /var/named/chroot//var/named/named.local
lrwxrwxrwx 1 root  named   39 Apr  1 22:32 named.zero -> /var/named/chroot//var/named/named.zero

Konfiguration "/etc/sysconfig/named"

Die Konfigurationsdatei /etc/sysconfig/named muss wie folgt angepasst werden, wobei hier auch wieder zu beachten ist, welche Zielsetzung verfolgt wird und ob der „NetworkManager“ zum Einsatz kommt.

Der Inhalt der Konfigurationsdatei /etc/sysconfig/named siht wie folgt aus:

# BIND named process options
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
# Currently, you can use the following options:
#
# ROOTDIR="/some/where"  --  will run named in a chroot environment.
#                            you must set up the chroot environment
#                            (install the bind-chroot package) before
#                            doing this.
#
# OPTIONS="whatever"     --  These additional options will be passed to named
#                            at startup. Don't add -t here, use ROOTDIR instead.
#
# ENABLE_ZONE_WRITE=yes  --  If SELinux is disabled, then allow named to write
#                            its zone files and create files in its $ROOTDIR/var/named
#                            directory, necessary for DDNS and slave zone transfers.
#                            Slave zones should reside in the $ROOTDIR/var/named/slaves
#                            directory, in which case you would not need to enable zone
#                            writes. If SELinux is enabled, you must use only the
#                            'named_write_master_zones' variable to enable zone writes.
#
# ENABLE_SDB=yes         --  This enables use of 'named_sdb', which has support
#                        --  for the ldap, pgsql and dir zone database backends
#                        --  compiled in, to be used instead of named.
#
# DISABLE_NAMED_DBUS=[1y]--  If NetworkManager is enabled in any runlevel, then
#                            the initscript will by default enable named's D-BUS
#                            support with the named -D option. This setting disables
#                            this behavior.
#
# KEYTAB_FILE="/dir/file"    --  Specify named service keytab file (for GSS-TSIG)
ROOTDIR=/var/named/chroot
OPTIONS="-4"

:!: HINWEIS - Falls der „NetworkManager“ zum Einstza kommt und dieser dazu benutzt wird einen „lokalen DNS-Server“ der auf der IP-Adresse „localhost –> 127.0.0.1“ horcht aufzusetzen (dies bietet sich an, wenn auf eine Namensauflösung auch dann nicht verzichten werden soll, wenn sich der z.B. Laptop nicht gerade im Netzwerk befindet), dann reicht die oben gezeigte Konfiguration aus.!

Das bedeutet, das die Konfigurationsdatei /etc/resolv.conf vom „NetworkManager“ verwaltet wird und so aussehen könnte:

# generated by NetworkManager, do not edit!
; Use a local caching nameserver controlled by NetworkManager
 
search tachtler.net
 
nameserver 127.0.0.1

:!: HINWEIS - Falls der „NetworkManager“ zum Einsatz kommt und dieser dazu benutzen wollen einen „permanent an ein Netzwerk angebundenen Rechner“ als DNS-Server zu betreiben, kanndas Ãberschrieben der Konfigurationsdatei /etc/resolv.conf mit folgender zusätlzichen Konfiguration verhindern werden:

# BIND named process options
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
...
#
ROOTDIR=/var/named/chroot
OPTIONS="-4"
DISABLE_NAMED_DBUS=[1y]

Das bedeutet, das die Konfigurationsdatei /etc/resolv.conf ebenfalls vom „NetworkManager“ verwaltet wird aber so aussehen könnte

# generated by NetworkManager, do not edit!
 
search tachtler.net
 
nameserver 192.168.0.1
nameserver 12.34.56.78
nameserver 12.34.56.90

Staren des DNS-Servers

Falls alles richtig gemacht wurde sollte der den DNS-Server (erneut) mit folgenden Befehlen gestartet werden und

# /sbin/service named restart

oder

# /sbin/service named start

nach der Meldung (hier ein „restart“)

# /sbin/service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]

mit folgendem Befehl die Bestätigung eingeholt werden, dass der DNS-Server läuft und nicht mehr unter dem Benutzer root, sondern unter dem Benutzer named betrieben wird.

# ps auxwm | grep named
named     2169  0.0  0.3  38788  3544 ?        -    Apr24   0:01 /usr/sbin/named -u named -4 -t /var/named/chroot
named        -  0.0    -      -     - -        Ssl  Apr24   0:00 -
named        -  0.0    -      -     - -        Ssl  Apr24   0:00 -
named        -  0.0    -      -     - -        Ssl  Apr24   0:00 -
named        -  0.0    -      -     - -        Ssl  Apr24   0:00 -
root      7150  0.0  0.0   3912   672 pts/2    -    01:09   0:00 grep named
Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
tachtler/dns_isc_bind_centos_5.txt · Zuletzt geändert: 2014/04/28 11:04 von klaus