Difference between revisions of "Cluster der kan alt/Install DNS server"

From Teknologisk videncenter
Jump to: navigation, search
m (Step five: Create a “rev.0.0.10.in-addr.arpa” file for reverse lookup)
m (Third step: Modify the resolv.conf file)
Line 79: Line 79:
 
search dka.local
 
search dka.local
 
</source>
 
</source>
 +
=Lock down the resolv.conf file=
 +
<source lang=cli>
 +
sudo chattr -f +i /etc/resolv.conf
 +
</source>
 +
Any problems with the resolv.conf file look [http://ubuntuforums.org/showthread.php?t=1978656| here]
  
 
===Fourth step: Define zones===
 
===Fourth step: Define zones===

Revision as of 16:22, 19 October 2014

Installer DNS Server

Install DNS server by download and install the package

apt-get install bind9

Configure DNS (Bind9)

First we will edit these 3 files.

  • /etc/bind/named.conf.local
  • /etc/bind/named.conf.options
  • /etc/resolvconf/resolv.conf.d/base

Second we will create these 2 files.

  • /etc/bind/zones/dka.local.db
  • /etc/bind/zones/rev.0.0.10.in-addr.arpa

First step: add domain zone – dka.local

Enter the named.conf.local file

nano /etc/bind/named.conf.local

Add the entire to the file

# Our Domain zone
zone "dka.local." {
        type master;
        file "/etc/bind/zones/dka.local.db";
};

# For reverse DNS
zone "0.0.10.in-addr.arpa" {
        type master;
        file "/etc/bind/zones/rev.0.0.10.in-addr.arpa.db";
};

Secund step: Add the DNS servers from your ISP

Enter the named.conf.options file

nano /etc/bind/named.conf.options

Delete or comment the following

        dnssec-validation auto;

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

Add the following to the bottom of the file

        forwarders {
                172.16.4.77;
         };

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

allow-query { 127.0.0.1; 172.16.4.66/24; 10.0.0.0/24;};
};
  • NOTE: Be aware of which IP segment you are in. 172.16.4.66 = Hovedforløb 172.16.2.50,172.16.2.51 = Grundforløb
  • NOTE: DNS nameserver is now 172.16.4.77 - older documentation may still refer to 172.16.4.66 as DNS nameserver

Third step: Modify the resolv.conf file

Enter the resolv.conf.d/base file

nano /etc/resolvconf/resolv.conf.d/base

Add the following lines

nameserver 127.0.0.1
nameserver 10.0.0.1
nameserver 172.16.4.77
domain dka.local
search dka.local

Lock down the resolv.conf file

sudo chattr -f +i /etc/resolv.conf

Any problems with the resolv.conf file look here

Fourth step: Define zones

First make the directory /etc/bind/zones

mkdir /etc/bind/zones

Second make the file dka.local.db

nano /etc/bind/zones/dka.local.db

Add the following text to the newly created file

; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns.dka.local. root.dka.local. (
                              8         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns.dka.local.
ns      IN      A       10.0.0.1
cluster IN      A       10.0.0.1
node1   IN      A       10.0.0.10
node2   IN      A       10.0.0.11
node3   IN      A       10.0.0.12
node4   IN      A       10.0.0.13

NOTES:

  • The TTL or time to live is set for 1 week

Step five: Create a “rev.0.0.10.in-addr.arpa” file for reverse lookup

Create the rev.0.0.10.in-addr.arpa file

nano /etc/bind/zones/rev.0.0.10.in-addr.arpa

Add the following text

$TTL 3D
@       IN      SOA     ns.dka.local. admin.dka.local. (
                2007062001
                28800
                604800
                604800
                86400
)
        IN      NS      ns.dka.local.
1       IN      PTR     ns.dka.local.
1       IN      PTR     cluster.dka.local.
10      IN      PTR     node1.dka.local.
11      IN      PTR     node2.dka.local.
12      IN      PTR     node3.dka.local.
13      IN      PTR     node4.dka.local.

Step six: Verify domain and DNS entries

Restart the network service

service bind9 restart

Dig

$ dig dka.local

Nslookup

nslookup ns