Build a DNS server in Linux and a dns server in linux

Source: Internet
Author: User
Tags nameserver

Build a DNS server in Linux and a dns server in linux
System Environment: CentOS 6.5 mini
IP Address: 192.168.100.100


1. Install related software packages
# Yum install-y bind * caching-nameserver


2. Open firewall ports
# 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. Disable selinux
# Vi/etc/selinux/config
SELINUX = disabled


4. Modify named. conf
# Vi/etc/named. conf

listen-on port 53 { any; };listen-on-v6 port 53 { any; };allow-query     { any; };


5. Add the domain to the bind main configuration file.

# 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 the 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. (                                        12         ; 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 added domain file.
# 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


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.