Pages

Saturday 28 July 2012

DNS in rhel6/Centos6

DNS in rhel6

For configuring DNS in rhel6 follow these simple steps.

Step 1 : Install the appropiate packages for DNS

#yum install bind* -y

Step 2: Set the hostname temp and permanent.

#hostname mail.xyz.com

Step 3: Now open /etc/named.conf (this file is used to configure the the primary and slave zone area).

Step 4: Now write on line

listen on port 53 { 127.0.0.1; any; };

zone "xyz.com" IN {
type master;
file "xyz.f"; #used for forward file
};

// I am choosing IP of class c 192.168.0.10

zone "0.168.192.in-addr.arpa" IN {
type master;
file "xyz.r"; #for reverse file
};

Save this file and move for detail zone configration.

Step 5: Go to /var/named and copy named.* to /var/named/chroot/var/named. Now create a new file (xyz.f) and write these lines.

$TTL 86400 #this number is in seconds
@ IN SOA mail.xyz.com. root.mail.xyz.com. (
0123
86400
86400
86400
86400
)
@ IN NS mail.xyz.com.
mail.xyz.com. IN A 192.168.0.10

Step 6: Now create a new reverse file (xyz.r) and write this.

$TTL 86400 #this number is in seconds

@ IN SOA mail.xyz.com. root.mail.xyz.com. (
0123
86400
86400
86400
86400
)
@ IN NS mail.xyz.com.
mail.xyz.com. IN A 192.168.0.10
10 IN PTR mail.xyz.com.
Step 7: Now run some command to check your dns server is working or not.
#chgrp named /var/named/chroot/var/named/*
To provide the control to named user.

#service named restart
#chkconfig named on

#dig mail.xyz.com
if the answer section comes that means your dns is working fine and if not you must made an mistake.

Do edit your resolve.conf file to tell which dns server to check. Entry will be
nameserver <Ip where ur dns exist>

Note: Do check your selinux and firewall before use.

No comments:

Post a Comment

Twitter Bird Gadget