Bind master-slave replication and subdomain authorization

Source: Internet
Author: User
Tags subdomain

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. Simultaneous time synchronization, version as consistent as possible, otherwise the main low from high



V. Subdomain authorization

    1. Configure the primary configuration file for a subdomain

[Email protected] ~]# vim/etc/named.rfc1912.zoneszone "cdn.magedu.com" in{type master; File "Cdn.magedu.com.zone";};

2. Add a zone resolution library file

$TTL  1D$ORIGIN cdn.magedu.com.@       IN       SOA ns1.cdn.magedu.com.     admin.cdn.magedu.com.  (                          2016103001                         1H                         5m                          7D             &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;1D)              IN          NS   ns1.cdn.magedu.com.ns1     in      a    192.168.3.8www     in      a    192.168.3.8www     in      a    192.168.3.8

3. In the primary DNS configuration file, add

Cdn.magedu.com. In NS ns1.cdn.magedu.com.ns1.cdn.magedu.com in A 192.168.3.8

4. Modify the subdomain DNS file permissions and check the syntax

[Email protected] named]# chown:named cdn.magedu.com.zone [[email protected] named]# chmod 640 cdn.magedu.com.zone [[EMA Il protected] named]# named-checkzone "Cdn.magedu.com.zone"/var/named/cdn.magedu.com.zone

5. Reread the configuration file

[Email protected] named]# service named Reload

6. Testing

Dig-t a www.cdn.magedu.com @192.168.3.8dig-t a www.cdn.magedu.com @192.168.3.9


This article is from the "Linux Sailing" blog, make sure to keep this source http://jiayimeng.blog.51cto.com/10604001/1869624

Bind master-slave replication and subdomain authorization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.