system Environment: CentOS 6.5 Mini
IP Address: 192.168.100.100
1. Install related packages
# yum Install-y bind* Caching-nameserver
2. Firewall Port Open
# Vi/etc/sysconfig/iptables
-ainput-m State--state new-m tcp-p TCP--dport 53-j ACCEPT
-ainput-m State--state new-m udp-p UDP--dport 53-j ACCEPT
-ainput-m State--state new-m tcp-p TCP--dport 953-j ACCEPT
# Service Iptables Restart
#/etc/rc.d/init.d/iptables Save
3. Turn off SELinux
# Vi/etc/selinux/config
Selinux=disabled
4. Modify Named.conf
# vi/etc/named.conf
Listen-on Port: (any;}; LISTEN-ON-V6 Port: (any;}; Allow-query {any;};
5. Add the domain in the main configuration file of bind
# Vi/etc/named.rfc1912.zones
Zone "baidu.com" in{ type master; File "Baidu.com.zone";}; Zone "doiido.com" in{ type master; File "Doiido.com.zone";}; Zone "1.10.in-addr.arpa" in { type master; File "1.10.zone";};
6. Create a zone file for the domain
(The file name here must be the same as above)
# cd/var/named
# Touch Baidu.com.zone
# Touch Doiido.com.zone
# Touch 1.10.zone
7. Edit Zone File
# VI Baidu.com.zone
$TTL 86400@ in SOA ns.baidu.com. Root ( 1 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H) ; minimum@ in NS ns.baidu.com.ns in a 115.239.211.110www in a 115.239.211.110
# VI Doiido.com.zone
$TTL 86400@ in SOA ns.doiido.com. Root ( 1 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H) ; minimum@ in NS ns.doiido.com.ns in a 1.1.1.1www in a 1.1.1.1
# VI 1.10.zone
$TTL 86400@ in SOA ns.doiido.com. ns.baidu.com. ( serial 28800 ; refresh 14400; retry 3600000 ; expire 86400) ; minimum@ in NS ns.doiido.com.1 in ptr www.doiido.com.110 in ptr Www.baidu.com.
8. Modify the permissions of the domain file you just added
# chmod o+r/var/named/*
9. Modify the resolv.conf file
# vi/etc/resolv.conf
NameServer 192.168.100.100
10. Test the configuration file
# Named-checkzone Doiido.com/var/named/doiido.com.zone
# Named-checkzone Baidu.com/var/named/baidu.com.zone
11. Restart the named service
# Service named restart
Linux Build DNS Server