Difference between revisions of "Cluster der kan alt/DNS Server"

From Teknologisk videncenter
Jump to: navigation, search
(First step: add domain zone – dka.dk)
(configure DNS (Bind))
 
(32 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
=Installation af DNS=
 
=Installation af DNS=
  
Instructions
+
Instruktioner
 
   
 
   
==Install DNS sserver software==
+
==Installer DNS Server==
  
 
sudo apt-get install bind9
 
sudo apt-get install bind9
  
 
==configure DNS (Bind)==
 
==configure DNS (Bind)==
We need to touch 5 files.
+
Vi skal bruge 5 filer.
 
   
 
   
 
We will edit 3 files.
 
We will edit 3 files.
 
#/etc/bind/named.conf.local
 
#/etc/bind/named.conf.local
 
#/etc/bind/named.conf.options
 
#/etc/bind/named.conf.options
#/etc/resolv.conf
+
#/etc/resolvconf/resolv.conf.d/base
 
   
 
   
 
We will create 2 files.
 
We will create 2 files.
#/etc/bind/zones/dka.dk.db
+
#/etc/bind/zones/dka.local.db
#/etc/bind/zones/rev.0.168.192.in-addr.arpa
+
#/etc/bind/zones/rev.0.0.10.in-addr.arpa.db
 
   
 
   
===First step: add domain zone – dka.dk===
+
===First step: add domain zone – dka.local===
  
  
 
*sudo vi /etc/bind/named.conf.local
 
*sudo vi /etc/bind/named.conf.local
 
<source lang=cli>
 
<source lang=cli>
# Our domain zone
+
# Our Domain zone
zone "dka.dk" {
+
zone "dka.local." {
  type master;
+
        type master;
  file "/etc/bind/zones/dka.db";
+
        file "/etc/bind/zones/dka.local.db";
}
+
};
+
 
# For reverse DNS  
+
# For reverse DNS
zone "0.168.192.in-addr.arpa" {
+
zone "0.0.10.in-addr.arpa" {
  type master;
+
        type master;
  file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
+
        file "/etc/bind/zones/rev.0.0.10.in-addr.arpa.db";
}
+
};
 +
 
 +
</source>
 +
 
 +
===Secund step: Add the DNS servers from your ISP===
 +
 
 +
# Sudo vi /etc/bind/named.conf.options
 +
 
 +
<source lang=cli>
 +
        forwarders {
 +
                172.16.4.66;
 +
        };
  
 +
        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;};
 +
};
  
 
</source>
 
</source>
  
We just created a new domain. Please note: later we will create two files named mydomain.com.db and rev.0.168.192.in-addr.arpa files. Also, notice the reverse IP address sequence in the reverse DNS section.
+
===Third step: Modify the resolv.conf file ===
+
 
# Let’s add the DNS servers from your ISP. In my case, I’m using Comcast DNS servers. You can place the primary and secondary DNS servers here separated by semicolons.
+
$ Sudo vi /etc/resolve.conf - Version 12.04 skal man ændre nano /etc/resolvconf/resolv.conf.d/base
  
 +
<source lang=cli>
 +
nameserver 10.0.0.1
 +
domain dka.local
 +
search dka.local
  
sudo vi /etc/bind/named.conf.options
+
</source>
  
forwarders
+
===Fourth step: Define zones===
  
  8.8.8.8
+
Sudo mkdir /etc/bind/zones
 +
Sudo vi /etc/bind/zones/dka.local.db
  
 +
<source lang=cli>
  
Save file. Exit.
+
; BIND data file for local loopback interface
+
;
# Now, let’s modify the resolv.conf file found in /etc and place the IP address of our DNS server which is set to 192.168.0.9.
+
$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
 +
ubuntu  IN      A      10.0.0.21
  
 +
</source>
  
$ sudo vi /etc/resolv.conf
 
  
search mydomain.com.
 
nameserver 192.168.0.9
 
# Now, let’s define the zones.
 
  
  
sudo mkdir /etc/bind/zones
 
sudo vi /etc/bind/zones/mydomain.com.db
 
);
 
TTL 3D
 
IN SOA ns.mydomain.com. admin.mydomain.com. (
 
  2007062001
 
  28800
 
  3600
 
  604800
 
  38400
 
);
 
mydomain.com.  IN      NS        ns.mydomain.com.
 
ubuntudesktop  IN      A          192.168.0.10
 
www            IN      CNAME      ubuntudesktop
 
pc            IN      A          192.168.0.11
 
gw            IN      A          192.168.0.1
 
                      TXT        "Network Gateway"
 
 
The TTL or time to live is set for 3 days
 
The TTL or time to live is set for 3 days
The ns.mydomain.com nameserver is defined
+
The ns.mydomain.com nameserver is defined
ubuntudesktop, pc and gateway are entered as an A record
+
ubuntudesktop, pc and gateway are entered as an A record
An alias of www is assigned to ubuntudesktop using CNAME
+
An alias of www is assigned to ubuntudesktop using CNAME
 
# Let’s create a “rev.0.168.192.in-addr.arpa” file for reverse lookup.
 
  
 +
===Step five: Create a “rev.0.0.10.in-addr.arpa” file for reverse lookup===
  
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa
+
Sudo nano /etc/bind/zones/rev.0.0.10.in-addr.arpa.db
  
 +
<source lang=cli>
 
$TTL 3D
 
$TTL 3D
@      IN      SOA    ns.mydomain.com. admin.mydomain.com. (
+
@      IN      SOA    ns.dka.local. admin.dka.local. (
 
                 2007062001
 
                 2007062001
 
                 28800
 
                 28800
Line 99: Line 111:
 
                 86400
 
                 86400
 
)
 
)
         IN      NS      ns.mydomain.com.
+
         IN      NS      ns.dka.local.
1       IN      PTR    gw.mydomain.com.
+
2       IN      PTR    ubuntu.dka.local
10      IN      PTR    ubuntudesktop.mydomain.com.
 
11      IN      PTR    pc.mydomain.com.
 
3. Let’s restart Bind to activate our latest changes.
 
  
 +
</source>
 +
 +
===Step seks: Test vores nye domæne og DNS entries===
  
sudo /etc/init.d/bind9 restart
 
4. Finally, let’s test our new domain and DNS entries.
 
 
 
Dig
 
Dig
  
 +
<source lang=cli>
 +
$ dig dka.local
 +
</source>
  
$ dig mydomain.com
 
 
Nslookup
 
Nslookup
  
 
+
<source lang=cli>
nslookup gw
+
nslookup ns
5. That’s it.
+
</source>
 
 
  
 
{{Source cli}}
 
{{Source cli}}
[[Category:Cliuster]][[Category:Ubuntu]]
+
[[Category:Cluster]][[Category:Ubuntu]]

Latest revision as of 13:04, 22 October 2014

Installation af DNS

Instruktioner

Installer DNS Server

sudo apt-get install bind9

configure DNS (Bind)

Vi skal bruge 5 filer.

We will edit 3 files.

  1. /etc/bind/named.conf.local
  2. /etc/bind/named.conf.options
  3. /etc/resolvconf/resolv.conf.d/base

We will create 2 files.

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

First step: add domain zone – dka.local

  • sudo vi /etc/bind/named.conf.local
# 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

  1. Sudo vi /etc/bind/named.conf.options
        forwarders {
                172.16.4.66;
         };

        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;};
};

Third step: Modify the resolv.conf file

$ Sudo vi /etc/resolve.conf - Version 12.04 skal man ændre nano /etc/resolvconf/resolv.conf.d/base

nameserver 10.0.0.1
domain dka.local
search dka.local

Fourth step: Define zones

Sudo mkdir /etc/bind/zones Sudo vi /etc/bind/zones/dka.local.db

; 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
ubuntu  IN      A       10.0.0.21



The TTL or time to live is set for 3 days The ns.mydomain.com nameserver is defined ubuntudesktop, pc and gateway are entered as an A record An alias of www is assigned to ubuntudesktop using CNAME

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

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

$TTL 3D
@       IN      SOA     ns.dka.local. admin.dka.local. (
                2007062001
                28800
                604800
                604800
                86400
)
        IN      NS      ns.dka.local.
2       IN      PTR     ubuntu.dka.local

Step seks: Test vores nye domæne og DNS entries

Dig

$ dig dka.local

Nslookup

nslookup ns