Hi friends,
Lets learn bind DNS master-slave configuration in chrooted jail environment.
We have DNS Master server
(station-x.domain40.example.com/172.24.40.100) and slave server (station-y.domain40.example.com/172.24.40.110)
Step1) Install bind packages on master server.
[root@station-x ~]#yum install bind-* caching-nameserver -y
Step 2) copy and configure named.conf file
[root@station-x ~]#cp -p /etc/named.conf
/var/named/chroot/etc/
[root@station-x ~]#vim /var/named/chroot/etc/named.conf
==================================
acl mylan {172.24.40.0/24; };
options {
listen-on port
53 { 127.0.0.1; 172.24.40.100; };
directory "/var/named";
dump-file
"/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost;
mylan; any; };
allow-transfer
{172.24.40.110; };
recursion no;
};
logging {
channel
default_debug {
file
"data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file
"named.ca";
};
include "/etc/named.rfc1912.zones";
===================================
[root@station-x ~]#cp -p /etc/named.rfc1912.zones /var/named/chroot/etc/named.rfc1912.zones
[root@station-x ~]#vim /var/named/chroot/etc/named.rfc1912.zones
==================================================
zone "localhost.localdomain" IN {
type master;
file
"named.localhost";
allow-update {
none; };
};
zone "localhost" IN {
type master;
file
"named.localhost";
allow-update {
none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file
"named.loopback";
allow-update {
none; };
};
zone "0.in-addr.arpa" IN {
type master;
file
"named.empty";
allow-update {
none; };
};
zone "domain40.example.com" IN {
type master;
file
"domain40.example.com.forward";
allow-update {
none; };
};
zone "40.24.172.in-addr.arpa" IN {
type master;
file
"domain40.example.com.reverse";
allow-update {
none; };
};
====================================================
step 3) create and configure zone files.
[root@station-x ~]#vi /var/named/chroot/var/named/domain40.example.com.forward
===========================================
$TTL 86400
@ IN
SOA station-x.domain40.example.com.
root.station-x.domain40.example.com. (
51 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D
) ; minimum
IN
NS
station-x.domain40.example.com.
IN MX
10 mail.domain40.example.com.
station-x IN A
172.24.40.100
station-y IN A
172.24.40.110
www.station-x IN A
172.24.40.100
mail IN A 172.24.40.100
ftp IN A
172.24.40.100
=============================
[root@station-x ~]#vim /var/named/chroot/var/named/domain40.example.com.reverse
====================================
$TTL 86400
@ IN SOA
station-x.domain40.example.com. root.station-x.domain40.example.com. (
1997022703 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400
) ; Minimum
IN NS
station-x.domain40.example.com.
100 IN PTR
station-x.domain40.example.com.
110 IN PTR
station-y.domain40.example.com.
============================
Step 4) check syntex of zone/config files and restart named
service.
[root@station-x ~]# named-checkconf
/var/named/chroot/etc/named.conf
[root@station-x ~]# named-checkconf
/var/named/chroot/etc/named.rfc1912.zones
[root@station-x ~]# named-checkzone
"40.24.172.in-addr.arpa"
/var/named/chroot/var/named/domain40.example.com.reverse
zone 40.24.172.in-addr.arpa/IN: loaded serial 1997022703
OK
[root@station-x ~]# named-checkzone domain40.example.com
/var/named/chroot/var/named/domain40.example.com.forward
zone domain40.example.com/IN: loaded serial 51
OK
[root@station-x ~]# /etc/init.d/named restart;chkconfig
named on
Stopping named: .
[ OK ]
Starting named:
[ OK ]
step 5) entry in resolve.conf and query for zone records
[root@station-x ~]# vi /etc/resolve.conf
search domain40.example.com
nameserver 172.24.40.100
nameserver172.24.40.110
dig station-x.domain40.example.com +short
dig -x 172.24.40.100 +short
Step 6) Install and configure bind packages in Slave server
[root@station-y ~]# yum -y install bind-* caching-nameserver
[root@station-y ~]# vi "/var/named/chroot/etc/named.conf"
======================================
acl mylan {172.24.40.0/24; };
options {
listen-on port
53 { 127.0.0.1; 172.24.40.110; };
directory "/var/named";
dump-file
"/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost;
mylan; any; };
recursion no;
};
logging {
channel
default_debug {
file
"data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file
"named.ca";
};
include "/etc/named.rfc1912.zones";
==============================
[root@station-y ~]# vi /var/named/chroot/etc/named.rfc1912.zones
===========================
zone "localhost.localdomain" IN {
type master;
file
"named.localhost";
allow-update {
none; };
};
zone "localhost" IN {
type master;
file
"named.localhost";
allow-update {
none; };
};
zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"
IN {
type master;
file
"named.loopback";
allow-update {
none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file
"named.loopback";
allow-update {
none; };
};
zone "0.in-addr.arpa" IN {
type master;
file
"named.empty";
allow-update {
none; };
};
zone "domain40.example.com" IN {
type slave;
masters
{172.24.40.100;};
file
"slaves/domain40.example.com.forward";
allow-update {
none; };
};
zone "40.24.172.in-addr.arpa" IN {
type slave;
masters
{172.24.40.100;};
file
"slaves/domain40.example.com.reverse";
allow-update {
none; };
};zone "localhost.localdomain" IN {
type master;
file
"named.localhost";
allow-update {
none; };
};
type master;
file
"named.localhost";
allow-update {
none; };
};
zone
"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"
IN {
type master;
file
"named.loopback";
allow-update {
none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file
"named.loopback";
allow-update {
none; };
};
zone "0.in-addr.arpa" IN {
type master;
file
"named.empty";
allow-update {
none; };
};
zone "domain40.example.com" IN {
type slave;
masters
{172.24.40.100;};
file
"slaves/domain40.example.com.forward";
allow-update {
none; };
};
zone "40.24.172.in-addr.arpa" IN {
type slave;
masters
{172.24.40.100;};
file
"slaves/domain40.example.com.reverse";
allow-update {
none; };
};
=====================================
[root@station-y ~]# vi /etc/resolve.conf
================
search domain40.example.com
nameserver 172.24.40.110
nameserver172.24.40.100
==========================
[root@station-y ~]# /etc/init.d/named restart;chkconfig
named on
[root@station-y ~]# dig station-x.domain40.example.com
@172.24.40.110 +short
[root@station-y ~]# dig -x 172.24.40.100 @172.24.40.110 +short
Note :- For basic troubleshooting please keep points to remember.
1) Please check server Selinux status.
2) Please check both system should have same time.
3) Please check proper permission and ownership of all
config and zone files.
4)For replicating zone files over master and slaves, please
use below command on slave
[root@station-y ~]# rndc reload domain40.example.com
[root@station-y ~]# rndc refresh edomain40.example.com
No comments:
Post a Comment