DNS SERVER -PRIMARY

How to install Dns Server
=========================

At a terminal prompt, enter the following command to install bind

 #sudo apt-get install bind9 

A very useful package for testing and troubleshooting DNS issues is the dnsutils package. To install dnsutils enter the following:

 #sudo apt-get install dnsutils  

WE are configuring the primary and Secondary Dns
1> Fist change the server ip to static to DNS server you are going to implement.

change iface eth0 inet dhcp to the iface eth0 inet static and add the following

iface eth0 inet static
address 192.168.153.128
netmask 255.255.255.0
gateway 192.168.153.2
network 192.168.153.0
broadcast 192.168.153.255  

2>

All the configuration file of bind9 lies in /etc/bind

Now we are configuring the primary DNS server
First we are configuring the Forward Zone File

3> Now go to /etc/bind and copy the file
Copy db.local to db.example.com you can name the file as you want and edit the file.

;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA web01.example.com. root.example.com. (
2 ; 2014070800
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS web01.example.com.
@ IN A 127.0.0.1
@ IN AAAA ::1
web01.example.com IN A 192.168.153.128  

You must increment the Serial Number every time you make changes to the zone file. If you make multiple changes before restarting BIND9, simply increment the
Serial once.

Now, you can add DNS records to the bottom of the zone file. See the section called “Common Record Types” for details.

[Note]
Many admins like to use the last date edited as the serial of a zone, such as 2007010100 which is yyyymmddss (where ss is the Serial Number)

Once you have made a change to the zone file BIND9 will need to be restarted for the changes to take effect:

 sudo /etc/init.d/bind9 restart 

 

 
Reverse Zone File

Now that the zone is setup and resolving names to IP Adresses a Reverse zone is also required. A Reverse zone allows DNS to resolve an address to a name.

Edit /etc/bind/named.conf.local and add the following:

zone "153.168.192.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.192";
};

[Note]
Replace 153.168.192 with the first three octets of whatever network you are using. Also, name the zone file /etc/bind/db.192 appropriately. It should match the first octet of your network.

Now create the /etc/bind/db.192 file:

  #sudo cp /etc/bind/db.127 /etc/bind/db.192 

Next edit /etc/bind/db.192 changing the basically the same options as /etc/bind/db.example.com:

;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA web01.example.com. root.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS web01.example.com.
192.168.153.128 IN PTR web01.example.com. 

The Serial Number in the Reverse zone needs to be incremented on each changes as well. For each A record you configure in /etc/bind/db.example.com you need to create a PTR record in /etc/bind/db.192.

After creating the reverse zone file restart BIND9:

 sudo /etc/init.d/bind9 restart 

Refer–> https://help.ubuntu.com/10.04/serverguide/dns-installation.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s