How to deploy master and slave DNS servers in centos7.x
This article mainly introduces how to deploy master and slave DNS servers in centos7.x, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
1. Prepare
Example: two sets 192.168.219.146 (master), 192.168.219.147 (slave), domain name www.panyangduola.com
Bind, bind-chroot and bind-utils are required for both master and slave DNS servers.
Yum-y install bind bind-utils bind-chroot
If the firewall is on, configure the firewall and add services (ignored if the firewall is disabled)
Firewall-cmd-permanent-add-service=dnsfirewall-cmd-reload
2. Main DNS server (192.168.219.146) configuration
Edit configuration file
Vim / etc/named.conf
Find two of the lines
Listen-on port 53 {127.0.0.1;}; allow-query {localhost;}
Modify to
Listen-on port 53 {any;}; allow-query {any;}
2-1. Configure forward resolution
Edit the file / etc/named.rfc1912.zones and add the fields that need to be parsed at the end
Vim / etc/named.rfc1912.zoneszone "panyangduola.com" IN {type master; file "data/panyangduola.com.zone";}
Create a panyangduola.com.zone resolution domain
Vim / var/named/data/panyangduola.com.zone$TTL 3600$ ORIGIN panyangduola.com.@ IN SOA panyangduola.com. Admin.panyangduola.com. (2018042101 1D 1H 1W 3H) @ IN NS ns1.panyangduola.com.@ IN NS ns2.panyangduola.com.ns1 IN A 192.168.219.146ns2 IN A 192.168.219.147www IN A 192.168.219.146web IN CNAME www
2-2. Configure reverse resolution
Edit the file / etc/named.rfc1912.zones and add the fields that need to be parsed at the end
Vim / etc/named.rfc1912.zoneszone "219.168.192.in-addr.arpa" IN {type master; file "data/219.168.192.zone";}
Create a 219.168.192.zone resolution domain
Vim / var/named/data/219.168.192.zone$TTL 3600$ ORIGIN 219.168.192.in ORIGIN addr.arpa.@ IN SOA panyangduola.com. Admin.panyangduola.com. (2018042101 1D 1H 1W 3H) @ IN NS ns1.panyangduola.com.@ IN NS ns2.panyangduola.com.146 IN PTR ns1.panyangduola.com.147 IN PTR ns2.panyangduola.com.146 IN PTR www.panyangduola.com.
2-3. Check the syntax of the DNS configuration file:
Cd / etcnamed-checkconf named.confnamed-checkconf named.rfc1912.zonescd / var/named/datanamed-checkzone panyangduola.com panyangduola.com.zonenamed-checkzone 219.168.192.in-addr.arpa 219.168.192.zone
2-4. Edit / etc/resolv.conf, add
Vim / etc/resolv.confsearch localdomainnameserver 192.168.219.146
2-5. If there are no errors in steps 2-3, start the named service
Restart named
Systemctl restart named
View statu
Systemctl status named
2-6. Check whether the parsing of the main DNS server is successful
Ping command verification
Ping-c 4 www.panyangduola.comnslookup command verifies nslookup > www.panyangduola.comnslookup > 192.168.219.146
3. Configure from DNS server (192.168.219.147)
Edit the named.conf file
Vim / etc/named.conf
Find two of the lines
Listen-on port 53 {127.0.0.1;}; allow-query {localhost;}
Modify to
Listen-on port 53 {any;}; allow-query {any;}
3-1. Modify the configuration / etc/named.rfc1912.zones of the main DNS server (192.168.219.146)
Vim / etc/named.rfc1912.zoneszone "panyangduola.com" IN {type master; file "data/panyangduola.com.zone"; allow-transfer {192.168.219.147;}; notify yes; also-notify {192.168.219.147;}; zone "219.168.192.in-addr.arpa" IN {type master; file "data/219.168.192.zone"; allow-transfer {192.168.219.147;}; notify yes Also-notify {192.168.219.147;};}
3-2. Configuration forward parsing from DNS server (192.168.219.147)
Edit the file / etc/named.rfc1912.zones and add the fields that need to be parsed at the end
Vim / etc/named.rfc1912.zoneszone "panyangduola.com" IN {type slave; file "data/panyangduola.com.zone"; masters {192.168.219.146;};}
Create an empty panyangduola.com.zone file
Touch / var/named/data/panyangduola.com.zone
Set owner
Cd / var/named/datachown named:named panyangduola.com.zone
3-3. Configuration reverse parsing from DNS server (192.168.219.147)
Add to the file / etc/named.rfc1912.zones
Vim etc/named.rfc1912.zoneszone "219.168.192.in-addr.arpa" IN {type slave; file "data/219.168.192.zone"; masters {192.168.219.146;};}
Create an empty file 219.168.192.zone
Touch / var/named/data/219.168.192.zone
Set owner
Cd / var/named/datachown named:named 219.168.192.zone
3-4. Check the syntax of the DNS configuration file:
Cd / etcnamed-checkconf named.confnamed-checkconf named.rfc1912.zones
3-5. Edit / etc/resolv.conf, add
Vim / etc/resolv.confsearch localdomainnameserver 192.168.219.147
3-6. If no errors occur in steps 3-4, start the named service
Restart named
Systemctl restart named
View statu
Systemctl status named
3-7. Check whether the files / var/named/data/panyangduola.com.zone and / var/named/data/219.168.192.zone have binary data.
Cat / var/named/data/panyangduola.com.zonecat / var/named/data/219.168.192.zone
3-8. Check whether the parsing from the DNS server is successful
Ping Command Verification ping-c 4 www.panyangduola.comnslookup Command Verification nslookup > 192.168.219.147 Thank you for reading this article carefully. I hope the article "how to deploy Master and Slave DNS Server in centos7.x" shared by the editor will be helpful to everyone. At the same time, I also hope you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!