2011年5月11日 星期三

Bind9 dns system with master and slave

1.install bind9 system packages on master and slave server
#apt-get update
#apt-get upgrade
#apt-get install bind9 bind9-doc


2.modify /etc/hosts and add two server record like this
#vim /etc/hosts
127.0.0.1 localhost
192.168.11.111 master.csp.com.tw master
192.168.11.50 slave.csp.com.tw slave

3.modify /etc/resolv.conf and add nameserver setting about master and slave
#vim /etc/resolv.conf
nameserver 192.168.11.111
nameserver 192.168.11.50


4.modify /etc/bind/named.conf.local on master to add new zone to allow transfer
#vim /etc/bind/named.conf.local
zone "csp.com.tw" {
type master;
file "/etc/bind/db.csp.com.tw";
allow-transfer {
192.168.11.50;
};
notify yes;
};

zone "2.10.10.in-addr.arpa" {
type master;
file "/etc/bind/db.10.10.2";
allow-transfer {
192.168.11.50;
};
notify yes;
};

5.add new file name db.csp.com.tw and db.10.10.2 about setting zone csp.com.tw
#vim /etc/bind/db.csp.com.tw

; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA csp.com.tw. admin. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
@ IN MX 5 mail1.csp.com.tw.
@ IN MX 10 mail2.csp.com.tw.

www1 IN A 66.77.88.120
www2 IN A 66.77.88.120
dns IN A 10.10.2.171
ftp IN A 10.10.2.172
mail1 IN A 10.10.2.200
mail2 IN A 10.10.2.201
webapp1 IN CNAME www1.csp.com.tw.
webapp2 IN CNAME www2.csp.com.tw.
================db.10.10.2=======================
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA csp.com.tw. admin. (
2011052301 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.csp.com.tw.

172 IN PTR ftp.csp.com.tw.

6.modify /etc/bind/named.conf.options
#vim /etc/bind/named.conf.options

acl "trusted" { 127.0.0.1; 192.168.11.0/24; };

options {
directory "/var/cache/bind";

allow-recursion { trusted; };
allow-transfer { none; };
notify no;

auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};

7.restart bind service on master server
#/etc/init.d/bind9 restart

8.modify /etc/bind/named.conf.local on slave server

#vim /etc/bind/named.conf.local

zone "csp.com.tw" {
type slave;
file "db.csp.com.tw";
masters {
192.168.11.111;
};
};

zone "2.10.10.in-addr.arpa" {
type slave;
file "db.10.10.2";
masters {
192.168.11.111;
};
};



9.restart bind service on slave server

10.check /var/cache/bind to find new file named db.csp.com.tw transfered from master server

沒有留言:

張貼留言