Wednesday, January 24, 2007

How to Create DNS ?

DNS Creation

Packages are bind-9.2.4-2
Here I Describe simple method to create a DNS , ( Not My methode is already on internet)

If ur using Redhat , suse
use rpm -qa | grep “packagename”
or rpm -qa “named”
In suse use yast tools there u directly install the package from internet
Yast is the beautiful Software management in suse type yast in terminal

First U need to Create a zone file in /etc/named.conf , To create A zone File

Edit vi /etc/named.conf Configuration file located in /etc/named.conf

zone "plannet.com" IN {
type master;
file "plannet.zone"; # This file is located in /var/named/plannet.zone
allow-update { none; };

};

# This Zone is used for Reverse ip

zone "127.64.132.132.in-addr.arpa" IN {
type master;
file "plannetre.zone"; # This file is locate in /var/named/plannetre.zone
allow-update { none; };
};
Nest step is to create two files which are mentioned above ( plannet.zone , planentre.zone)
Before That we want to edit in hosts file and Resolve file
Edit vi /etc/hosts

Here node1 is my host name above plannet is my zone
127.0.0.1 node1 localhost.localdomain localhost
132.132.64.127 node1.plannet.com node1

Resolve -- Adding Name server
Nest go to vi /etc/resolv.conf to create DNS ip means ur ip which assign in eth0 network card
add Dns here
vi /etc/resolv.conf
nameserver 132.132.64.127
or your localhost ip number

Than move to create a forward file and revers file Redhat El file is located at /var/named/chroot/var/named/localhost , Other Flavours Like Suse BSD unix are in /var/named

First copy localhost.zone to your create zone plannet.zone

Nest Copy reverse file named.local to plannetre.zone here re is indicated reverse zone

Edit ur zone file

vi localhost.zone (Details of Localhost file , Just compare two Files U can find where i change for my requirments)

$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS @
IN A 127.0.0.1
IN AAAA ::1
vi plannet.zone ( Below I mentions the Details of the files )

$TTL 86400
@ IN SOA node1.plannet.com. root.node1.plannet.com. (

42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS node1.plannet.com.

node1.plannet.com. IN A 132.132.64.127 ---> This A record my machine
www IN A 132.132.64.127 -- > This is for www
www1 IN CNAME node1.plannet.com. ---> This is Cname
www 0 IN A 132.132.64.127
oscommerce IN A 132.132.64.127
phpmyadmin.plannet.com. IN A 132.132.64.130 # This is my network ip 130 to 132 Just point to this ip Also i mention later How i use ip in httpd virtual host
php.plannet.com. IN A 132.132.64.127
remote.plannet.com. IN A 132.132.64.127
brijesh. IN A 61.2.197.50
brivimo.plannet.com. IN A 132.132.64.131
search.plannet.com. IN A 132.132.64.132
mail.plannet.com. IN A 132.132.64.132

Nest edit reverse zone

vi named.local
$TTL 86400

@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

Edit our reverse vi plannetre.zone

$TTL 86400

@ IN SOA node1.plannet.com. root.node1.plannet.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS node1.plannet.com.
IN PTR node1.plannet.com.
IN PTR phpmyadmin.plannet.com.
IN PTR oscommerce.plannet.com.
IN PTR remote.plannet.com.
1 IN PTR brivimo.plannet.com.
2 IN PTR search.plannet.com.
3 IN PTR mail.plannet.com.
4 IN PTR brijesh.plannet.com.

Restart the service

Restart The Services /etc/init.d/named restart
/etc/init.d/network restart
Reboot ur machine
check whether ur Dns is working
U can use dig , nslookup , hosts

dig www.plannet.com
dig -x (x use for ip seearch) 132.132.64.127

nslookup www.plannet.com

nslookup 132.132.64.127

nslookup oscommerce.plannet.com

No comments:

Post a Comment

Powered By Blogger