System Conventions:
1. Domain Name: redhat.com
2, ns:192.168.101.168
3, web:192.168.101.11, 192.168.101.12
4, mail:192.168.101.10
1. Install bind
Yum Install Bind-libs bind-utils bind
2. Turn off SELinux, firewall
Vim/etc/selinux/config
Selinux=disabled
Setenforce 0
Service Iptables Stop
Chkconfig iptables off
3. Configure bind
Cp/etc/named.conf/etc/named.conf.bak
Vim/etc/named.conf
Options {
Directory "/var/named";
# limit IP Recursive queries
allow-recursion {192.168.101.0/24;};
};
Zone "." in {
Type hint;
File "named.ca";
};
Zone "localhost" in {
Type master;
File "Named.localhost";
};
Zone "0.0.127.in-addr.arpa" in {
Type master;
File "Named.loopback";
};
4. Modify DNS
Vim/etc/resolv.conf
NameServer 192.168.101.168
5. Test configuration file
Named-checkzone "localhost"/var/named/named.localhost
Named-checkzone "0.0.127.in-addr.arpa"/var/named/named.loopback
6. Start bind
# during startup if the quote: Generating/etc/rndc.key
# workaround generates a rndc-key:
Rndc-confgen-r/dev/urandom-a
Service named start
7. Test to find root DNS
Dig-t NS. @192.168.101.168
Ping www.baidu.com
Chkconfig named on
# At this point a DNS cache server configuration is complete.
8. Configuration forward parsing
Vim/etc/named.conf
Add
Zone "Redhat.com" in {
Type master;
File "Redhat.com.zone";
};
9. Add forward parsing configuration file
Vim/var/named/redhat.com.zone
$TTL 86400
@ in SOA ns1.redhat.com. Admin.redhat.com. (
2015010101; Serial
1H; Refresh
5M; Retry
1W; Expire
3H); Minimum
In NS ns1
In MX ten Mail
NS1 in A 192.168.101.168
Mail in A 192.168.101.10
www in A 192.168.101.11
www in A 192.168.101.12
# License Related Documents
chmod 640/var/named/redhat.com.zone
Chgrp Named/var/named/redhat.com.zone
10. Configure Reverse resolution
Vim/etc/named.conf
Add
Zone "101.168.192.in-addr.arpa" in {
Type master;
File "192.168.101.zone";
};
11. Add Reverse resolution configuration file
Vim/var/named/192.168.101.zone
$TTL 86400
@ in SOA ns1.redhat.com. Admin.redhat.com. (
2015010101; Serial
1H; Refresh
5M; Retry
1W; Expire
3H); Minimum
In NS ns1.redhat.com.
168 in PTR ns1.redhat.com.
Ten in PTR mail.redhat.com.
One in PTR www.redhat.com.
In PTR www.redhat.com.
# License Related Documents
chmod 640/var/named/192.168.101.zone
Chgrp Named/var/named/192.168.101.zone
12. Test and restart
Named-checkconf
Named-checkzone "Redhat.com"/var/named/redhat.com.zone
Named-checkzone "101.168.192.in-addr.arpa"/var/named/192.168.101.zone
Service named restart
13. Test analysis
Dig-t NS redhat.com
Dig-t A www.redhat.com
Dig-t MX redhat.com
Dig-x 192.168.101.10
Dig-x 192.168.101.11
Dig-x 192.168.101.12
Linux DNS Service installation configuration