The positive and negative areas of bind are resolved as follows
http://jiayimeng.blog.51cto.com/10604001/1852025
Second, from the DNS configuration file/etc/named.conf and the primary DNS configuration,
[[email protected] ~]# vim /etc/named.conf listen-on port 53 { 127.0.0.1; 192.168.3.8; }; listen-on-v6 port 53 { ::1; }; 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; }; recursion yes; [[email protected] ~]# named-checkconf #检查主配置文件
Edit the zone file/etc/named.rf1912.zones, followed by add positive and negative parsing, as follows:
[Email protected] ~]# Vim/etc/named.rfc1912.zoneszone "magedu.com" in {type slave; Masters {192.168.3.9;}; File "slaves/magedu.com"; allow-update {none;};}; Zone "3.168.192.in-addr.arpa" in {type slave; Masters {192.168.3.9;}; File "Slaves/192.168.3.zone"; allow-update {none;};};
Third, test from DNS
#开启服务 [[email protected] ~]# service named startgenerating /etc/rndc.key: [ ok ]Starting named: [ OK ] #查看是否从主服务器复制有文件 [[email protected] ~]# cd /var/named/slaves[[email protected] slaves]# lltotal 8-rw-r--r-- 1 named named 475 Nov 4 08:29 192.168.3.zone-rw-r--r-- 1 named named 490 nov 4 08:29 magedu.com# test parsing [[Email protected] slaves]# dig -t ns magedu.com @192.168.3.8; <<>> dig 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6_8.3 <<>> -t ns magedu.com @ 192.168.3.8;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19495;; flags: qr aa rd ra; query: 1, answer: 2, authority: 0, ADDITIONAL: 2;; QUESTION SECTION:;magedu.com.INNS;; ANSWER SECTION:magedu.com.86400INNSns2.magedu.com.magedu.com.86400INNSns1.magedu.com.;; ADDITIONAL SECTION:ns1.magedu.com.86400INA192.168.3.9ns2.magedu.com.86400INA192.168.3.9;; Query time: 2 msec;; server: 192.168.3.8#53 (192.168.3.8); WHEN: Fri Nov 4 08:32:25 2016;; msg size rcvd: 96[[email protected] slaves]# dig -t ns magedu.com @192.168.3.9; <<>> dig 9.8.2rc1-redhat-9.8.2-0.47.rc1.el6_8.3 <<>> -t ns magedu.com @ 192.168.3.9;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16105;; flags: qr aa rd ra; query: 1, answer: 2, authority: 0, ADDITIONAL: 2;; QUESTION SECTION:;magedu.com.INNS;; ANSWER SECTION:magedu.com.86400INNSns2.magedu.com.magedu.com.86400INNSns1.magedu.com.;; ADDITIONAL SECTION:ns1.magedu.com.86400INA192.168.3.9ns2.magedu.com.86400INA192.168.3.9;; Query time: 2 msec;; server: 192.168.3.9#53 (192.168.3.9); WHEN: Fri Nov 4 08:33:01 2016;; msg size rcvd: 96
Iv. master/Slave synchronization
The master server adds a record [[email protected] named]# vim /var/named/magedu.com.zone $TTL 86400$ Origin magedu.com.@ in soa ns1.magedu.com. admin.magedu.com ( 2016110401 1H 5M 7D &NBSP;1D) IN NS ns1.magedu.com. IN NS ns2.magedu.com. IN MX 10 mx1 in mx 20 mx2ns1 IN a 192.168.3.9ns2 in A 192.168.3.9mx1 IN A 192.168.3.9mx2 in a 192.168.3.9www IN A 192.168.3.9jym IN cname wwwimg in a 192.168.3.9 #添加的A记录
Primary DNS Reread configuration file
[[Email protected] named]# service named Reload reload named: [OK]
To prevent synchronization failures, Selinux,iptables release should be turned off.
This article is from the "Linux Sailing" blog, make sure to keep this source http://jiayimeng.blog.51cto.com/10604001/1869596
Bind master-slave replication and subdomain authorization