First, forward analysis
1. Installation
Yum install-y bind
2. Edit the configuration file
Vim/etc/named.conf
Add to
Zone "123.com" in {
Type master;
File "123.com.zone";
};
3. Editing 123.zone files
Vim/var/named/123.com.zone
$TTL 1D
@ in SOA @ admin.123.com. (
2016060301; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
In NS ns.123.com.
In MX 5 mail.123.com.
Mail in A 10.10.13.248
NS in A 10.10.13.247
www in A 11.11.11.11
BBS in CNAME www
4. Restart the service test
/etc/init.d/named restart
Dig @10.10.13.247 www.123.com
; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6 <<>> @10.10.13.247 www.123.com
; (1 server found)
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:11907
;; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, additional:1
;; QUESTION section:
; www.123.com. In A
;; ANSWER section:
www.123.com. 86400 in A 11.11.11.11
;; Authority section:
123.com. 86400 in NS ns.123.com.
;; ADDITIONAL section:
ns.123.com. 86400 in A 10.10.13.247
;; Query time:0 msec
;; server:10.10.13.247#53 (10.10.13.247)
;; When:fri June 3 10:49:35 2016
;; MSG SIZE rcvd:78
Second, reverse analysis
1. Edit the configuration file
Vim/etc/named.conf
Add to
Zone "13.10.10.in-addr.arpa" in {
Type master;
File "13.10.10.zone";
};
2. Edit Zone File
Vim/var/named/13.10.10.zone
$TTL 1D
@ in SOA @ admin.123.com. (
2016060301; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
In NS ns.123.com.
247 in PTR ns.123.com.
248 in PTR mail.123.com.
3. Restart the test
/etc/init.d/named restart
Dig @10.10.13.247-x 10.10.13.248
; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6 <<>> @10.10.13.247-x 10.10.13.248
; (1 server found)
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:64644
;; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, additional:1
;; QUESTION section:
; 248.13.10.10.in-addr.arpa. In PTR
;; ANSWER section:
248.13.10.10.in-addr.arpa. 86400 in PTR mail.123.com.
;; Authority section:
13.10.10.in-addr.arpa. 86400 in NS ns.123.com.
;; ADDITIONAL section:
ns.123.com. 86400 in A 10.10.13.247
;; Query Time:1 msec
;; server:10.10.13.247#53 (10.10.13.247)
;; When:fri June 3 10:53:14 2016
;; MSG SIZE rcvd:102
Third, the DNS master-slave configuration
1. Install the BIND program from the server and configure
[email protected] ~]# Yum install-y bind
[Email protected] ~]# vim/etc/named.conf
Listen-on Port 53 {127.0.0.1;};
Listen-on-v6 Port 53 {:: 1;}; #用//Comment out these two lines
Add the following
Zone "123.com" in {
Type slave;
File "Slaves/123.com.zone";
Masters {10.10.13.247;};
};
Zone "13.10.10.in-addr.arpa" in {
Type slave;
File "Slaves/13.10.10.zone";
Masters {10.10.13.247;};
};
2. Start the BIND service from the server
/etc/init.d/named start
3, verify the master-slave
[Email protected] ~]# ls/var/named/slaves/
123.com.zone 13.10.10.zone
Two zone files have been generated under #/var/named/slaves/
View zone files as with the primary server
4, verify the forward parsing
[Email protected] slaves]# dig @10.10.13.248 www.123.com
; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6 <<>> @10.10.13.248 www.123.com
; (1 server found)
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:11713
;; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, additional:1
;; QUESTION section:
; www.123.com. In A
;; ANSWER section:
www.123.com. 86400 in A 11.11.11.11
;; Authority section:
123.com. 86400 in NS ns.123.com.
;; ADDITIONAL section:
ns.123.com. 86400 in A 10.10.13.247
;; Query Time:1 msec
;; server:10.10.13.248#53 (10.10.13.248)
;; When:fri June 3 11:18:11 2016
5, verify the inverse analysis
[Email protected] slaves]# dig @10.10.13.248-x 10.10.13.248
; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6 <<>> @10.10.13.248-x 10.10.13.248
; (1 server found)
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:9372
;; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, additional:1
;; QUESTION section:
; 248.13.10.10.in-addr.arpa. In PTR
;; ANSWER section:
248.13.10.10.in-addr.arpa. 86400 in PTR mail.123.com.
;; Authority section:
13.10.10.in-addr.arpa. 86400 in NS ns.123.com.
;; ADDITIONAL section:
ns.123.com. 86400 in A 10.10.13.247
;; Query time:0 msec
;; server:10.10.13.248#53 (10.10.13.248)
;; When:fri June 3 11:18:41 2016
;; MSG SIZE rcvd:102
Iv. setting up the primary server configuration immediately from the server when the primary server changes
1. Edit the configuration file on the primary server
Vim/etc/named.conf
Modify Zone "123.com" in {
Type master;
File "123.com.zone";
};
Zone "13.10.10.in-addr.arpa" in {
Type master;
File "13.10.10.zone";
};
Switch
Zone "123.com" in {
Type master;
File "123.com.zone";
Notify yes;
also-notify {10.10.13.248;};
};
Zone "13.10.10.in-addr.arpa" in {
Type master;
File "13.10.10.zone";
Notify yes;
also-notify {10.10.13.248;};
};
#添加notify Yes;
Also-notify (10.10.13.248;); indicates that master server data is immediately replicated from the server when the primary server updates data
2. Modify the serial number of the zone file on the primary server and add a record
Vim/var/named/slaves/123.com.zone
will be 2016060301; Serial
Change to 2016060302; Serial
Add a record
River A 111.111.111.111
2. Restart the primary server test resolution
/etc/init.d/named restart
Dig @10.10.13.247 river.123.com
; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6 <<>> @10.10.13.247 river.123.com
; (1 server found)
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:5069
;; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, additional:1
;; QUESTION section:
; river.123.com. In A
;; ANSWER section:
river.123.com. 86400 in A 111.111.111.111
;; Authority section:
123.com. 86400 in NS ns.123.com.
;; ADDITIONAL section:
ns.123.com. 86400 in A 10.10.13.247
;; Query time:0 msec
;; server:10.10.13.247#53 (10.10.13.247)
;; When:fri June 3 11:50:00 2016
;; MSG SIZE rcvd:80
3, view from the server configuration and resolution
Cat/var/named/slaves/123.com.zone
$ORIGIN.
$TTL 86400; 1 day
123.com in SOA 123.com. admin.123.com. (
2016060302; Serial
86400; Refresh (1 day)
3600; Retry (1 hour)
604800; Expire (1 week)
10800; Minimum (3 hours)
)
NS ns.123.com.
MX 5 mail.123.com.
$ORIGIN 123.com.
BBS CNAME www
Mail A 10.10.13.248
NS A 10.10.13.247
River A 111.111.111.111
www A 11.11.11.11
#已经更改序列号和添加一条river. 123.com Records
[Email protected] slaves]# dig @10.10.13.248 river.123.com
; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6 <<>> @10.10.13.248 river.123.com
; (1 server found)
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:3135
;; FLAGS:QR AA Rd RA; Query:1, Answer:1, Authority:1, additional:1
;; QUESTION section:
; river.123.com. In A
;; ANSWER section:
river.123.com. 86400 in A 111.111.111.111
;; Authority section:
123.com. 86400 in NS ns.123.com.
;; ADDITIONAL section:
ns.123.com. 86400 in A 10.10.13.247
;; Query time:59 msec
;; server:10.10.13.248#53 (10.10.13.248)
;; When:fri June 3 11:52:01 2016
;; MSG SIZE rcvd:80
#可以解析主服务器新增加的记录
This article is from the "愺 Burgundy pounding his 豩" blog, please be sure to keep this source http://riverxyz.blog.51cto.com/533303/1785765
DNS installation Configuration