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

From Teknologisk videncenter
Jump to: navigation, search
(First step: add domain zone – dka.dk)
Line 16: Line 16:
 
   
 
   
 
We will create 2 files.
 
We will create 2 files.
#/etc/bind/zones/dka.dk.db
+
#/etc/bind/zones/mydomain.com.db
 
#/etc/bind/zones/rev.0.168.192.in-addr.arpa
 
#/etc/bind/zones/rev.0.168.192.in-addr.arpa
 
   
 
   
===First step: add domain zone – dka.dk===
+
===First step: add domain zone – mydomain.com===
  
  
Line 25: Line 25:
 
<source lang=cli>
 
<source lang=cli>
 
# Our domain zone
 
# Our domain zone
zone "dka.dk" {
+
zone "mydomain.com" {
 
   type master;
 
   type master;
   file "/etc/bind/zones/dka.db";
+
   file "/etc/bind/zones/mydomain.com.db";
 
}
 
}
 
   
 
   
Line 35: Line 35:
 
   file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
 
   file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
 
}
 
}
 
 
 
 
</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.
+
===Secund step: Add the DNS servers from your ISP===
 
# 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/bind/named.conf.options
  
sudo vi /etc/bind/named.conf.options
+
<source lang=cli>
 
+
Forwarders {
forwarders
+
  x.x.x.x
 
+
};
  8.8.8.8
 
 
 
 
 
Save file. Exit.
 
   
 
# 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.
 
 
 
 
 
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/dka.dk.db
 
);
 
TTL 3D
 
IN SOA ns.mydomain.com. admin.dka.dk. (
 
  2007062001
 
  28800
 
  3600
 
  604800
 
  38400
 
);
 
dka.dk.        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 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
 
 
# Let’s create a “rev.0.168.192.in-addr.arpa” file for reverse lookup.
 
 
 
 
 
sudo vi /etc/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.dka.dka.
 
11      IN      PTR    pc.dka.dk.
 
);
 
3. Let’s restart Bind to activate our latest changes.
 
 
 
 
 
sudo /etc/init.d/bind9 restart
 
4. Finally, let’s test our new domain and DNS entries.
 
 
Dig
 
 
 
 
 
$ dig mydomain.com
 
Nslookup
 
  
  
nslookup gw
 
5. That’s it.
 
  
  
 
{{Source cli}}
 
{{Source cli}}
 
[[Category:Cliuster]][[Category:Ubuntu]]
 
[[Category:Cliuster]][[Category:Ubuntu]]

Revision as of 13:04, 18 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 "mydomain.com" {
   type master;
   file "/etc/bind/zones/mydomain.com.db";
}
 
# For reverse DNS 
zone "0.168.192.in-addr.arpa" {
   type master;
   file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
}

Secund step: Add the DNS servers from your ISP

  1. Sudo vi /etc/bind/named.conf.options

<source lang=cli> Forwarders {

x.x.x.x

};