How to install bind on DNS
This article will explain in detail how to install bind on DNS. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Four test servers: mail, www, master dns, slave DNS
Main DNS: 192.168.1.27
Www: 192.168.1.28
Mail: 192.168.1.29
From DNS: 192.168.1.34
Install bind on master and slave dns
Yum install bind
Configure DNS by using the newly created configuration file
The following operations are implemented on the main DNS
1. Type the original configuration file as bak
[root@localhost ~] # mv / etc/named.conf / etc/named.conf.bak
2. Rebuild the main configuration file named.conf
[root@localhost ~] # vim / etc/named.conf
Options {
Directory "/ var/named"
}
Zone "." IN {# Root Resolution
Type hint
File "named.ca"; # root parse file path
}
Zone "localhost." IN {# Native forward parsing
Type master
File "named.localhost"; # File path for native forward parsing
}
Zone "1.0.0.127.in-addr.arpa." IN {# Native reverse parsing
Type master
File "named.loopback"; # File path for local reverse parsing
}
3. Modify the master group and permissions of / etc/named.conf
[root@localhost ~] # chown root:named / etc/named.conf
[root@localhost ~] # chmod 640 / etc/named.conf
4. Check the configuration file for syntax errors
[root@localhost ~] # service named configtest
Zone localhost/IN: loaded serial 0
Zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
5. Start the named service
[root@localhost ~] # service named start
Generating / etc/rndc.key: [OK]
Start named: [OK]
6. Add zones to the configuration file / etc/named.conf
Zone "shamereedwine.com." IN {
Type master
File "shamereedwine.com.zone"
}
7. Create a zone file shamereedwine.com.zone
In the cd / var/named directory
Vim shamereedwine.com.zone
$TTL 600
@ IN SOA dns.shamereedwine.com. Admin.shamereedwine.com. (
2017061801
2H
10M
7D
1D)
@ IN NS dns
@ IN MX 10 mail
Dns IN A 192.168.1.27
Mail IN A 192.168.1.29
Www IN A 192.168.1.28
Pop IN CNAME mail
Ftp IN CNAME www
8. Modify the group and owner of the area file shamereedwine.com.zone
[root@localhost named] # chown root:named shamereedwine.com.zone
[root@localhost named] # chmod 640 shamereedwine.com.zone
9. Check for grammatical errors
[root@localhost named] # service named configtest
Zone localhost/IN: loaded serial 0
Zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
Zone shamereedwine.com/IN: loaded serial 2017061801
10. Restart named service
[root@localhost named] # service named restart
Stop named:. [OK]
Start named: [OK]
11. Use dig command to test dns parsing
[root@localhost named] # dig-t NS shamereedwine.com
; DiG 9.8.2rc1-RedHat-9.8.2-0.62.rc1.el6_9.2-t NS shamereedwine.com
;; global options: + cmd
;; Got answer:
;;-> > HEADERHEADERHEADER www.shamereedwine.com
Server: 192.168.1.27
Address: 192.168.1.27#53
Name: www.shamereedwine.com
Address: 192.168.1.28
> set q=MX
> shamereedwine.com
Server: 192.168.1.27
Address: 192.168.1.27#53
Shamereedwine.com mail exchanger = 10 mail.shamereedwine.com.
> Q
Server: 192.168.1.27
Address: 192.168.1.27#53
8. Configure reverse parsing configuration file
Vim / etc/named.rfc1912.zones
Add the reverse parsing area parameters shown below
Zone "1.168.192.in-addr.arpa" IN {
Type master
File "192.168.1.zone"
}
9. Configure reverse parsing zone files
Cd / var/named
Vim 192.168.1.zone
$TTL 600
@ IN SOA dns.shamereedwine.com. Dnsadmin.shamereedwine.com. (
2017061801
1H
5M
3D
12H)
IN NS dns.shamereedwine.com.
27 IN PTR dns.shamereedwine.com.
28 IN PTR www.shamereedwine.com.
29 IN PTR mail.shamereedwine.com.
Chown root:named 192.168.1.zone # change ownership and group
Chmod 640 192.168.1.zone # set permissions
10. Test the correctness of the main configuration file and area file
Service named configtest
Zone localhost.localdomain/IN: loaded serial 0
Zone localhost/IN: loaded serial 0
Zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
Zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
Zone 0.in-addr.arpa/IN: loaded serial 0
Zone shamereedwine.com/IN: loaded serial 2017061801
Zone 1.168.192.in-addr.arpa/IN: loaded serial 2017061801
11. Restart service
Service named reload
12. Test reverse parsing # parsing 192.168.1.27
[root@dns named] # dig-x 192.168.1.27
; DiG 9.8.2rc1-RedHat-9.8.2-0.62.rc1.el6_9.2-x 192.168.1.27
;; global options: + cmd
;; Got answer:
;;-> > HEADER