DNS Quickie

DNS Quickie 

The nameserver is a program that matches an IP address say (192.168.0.244) to a hostname say (test.linuxnepal.com.np). It also provides for matching in the opposite direction as well, informing you that the machine that has the address 192.168.0.244 is called test.linuxnepal.com.np.

To setup the Domain Name Server, following files and directories have to be handled.

1. /etc/resolv.conf (File) 

2. /etc/named.conf (File) 

3. /var/named (Directory) 

Assumptions: 

Let us assume that we are going to setup the DNS with following specifications:

domainname = linuxnepal.com.np 

ipaddress= 192.168.0.244 

hostname = test.linuxnepal.com.np 

Configuration Steps: 

Please follow the steps below to setup each files and directories:

1. Setup /etc/resolv.conf 

In this file add the lines given below:

search <domainname> 

nameserver <ipaddress> 

search linuxnepal.com.np 

nameserver 192.168.0.244 

2. Setup /etc/named.conf

Add these two lines in /etc/named.conf 

for forward DNS 

zone “linuxnepal.com.np”{

type master;file “db.for”

};

For reverse DNS

zone “0.168.192.in-addr.arpa”

{

type master;

file “db.rev”

};

3. Setup /var/named 

For Forward DNS

create a file /var/named/db.for 

linuxnepal.com.np. IN SOA test.linuxnepal.com.np. hostmaster.test.linuxnepal.com.np. (

23 

10800 

3600 

604800 

86400 ) 

IN NS test.linuxnepal.com.np. 

test.linuxnepal.com.np. IN A  192.168.0.244 

www.linuxnepal.com.np. IN CNAME test.linuxnepal.com.np.

ftp.linuxnepal.com.np. IN CNAME test.linuxnepal.com.np.

linuxnepal.com.np. IN MX 10 test.linuxnepal.com.np.

*.linuxnepal.com.np. IN MX 10 test.linuxnepal.com.np.

For Reverse DNS

Create a file /var/named/db.rev

0.168.192.in-addr.arpa. IN SOA test.linuxnepal.com.np. hostmaster.test.linuxnepal.com.np. ( 

23 

10800 

3600 

604800 

86400 ) 

IN NS test.linuxnepal.com.np. 

244 IN PTR test.linuxnepal.com.np. 

To activate named 

======================= 

Run command 

# killall -HUP named 

or

service named restart

You can later on check your DNS with programs like nslookup.

Leave a Reply

Your email address will not be published. Required fields are marked *


*