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

From Teknologisk videncenter
Jump to: navigation, search
m (Fourth step: Define zones)
Line 24: Line 24:
 
*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 "mydomain.com" {
+
zone "dka.local." {
  type master;
+
        type master;
  file "/etc/bind/zones/mydomain.com.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";
}
+
};
 +
 
 
</source>
 
</source>
  
Line 42: Line 43:
  
 
<source lang=cli>
 
<source lang=cli>
Forwarders {
+
        forwarders {
x.x.x.x
+
                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>
  

Revision as of 09:17, 19 April 2012

Installation af DNS

Instructions

Install DNS sserver software

sudo apt-get install bind9

configure DNS (Bind)

We need to touch 5 files.

We will edit 3 files.

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

We will create 2 files.

  1. /etc/bind/zones/mydomain.com.db
  2. /etc/bind/zones/rev.0.168.192.in-addr.arpa

First step: add domain zone – mydomain.com

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

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

search dka.dk.
nameserver 10.0.0.1

Fourth step: Define zones

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

$TTL 3D
@ IN SOA ns.dka.dk. admin.dka.dk. (
   2007062001
   28800
   3600
   604800
   38400
);
dka.dk.  IN      NS         ns.dka.dk.
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 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.168.192.in-addr.arpa” file for reverse lookup

Sudo vi /tec/bind/zones/rev.0.168.192.in-addr.arpa

$TTL 3D
@       IN      SOA     ns.dka.dk. admin.dka.dk. (
                2007062001
                28800
                604800
                604800
                86400
)
        IN      NS      ns.dka.dk.
1       IN      PTR     gw.dka.dk.
10      IN      PTR     ubuntudesktop.mydomain.com.
11      IN      PTR     pc.dka.dk.

Step six: Test our new domain and DNS entries

Dig

$ dig dka.dk

Nalookup

nslookup gw

Step seven: That's it