DNS Server Installation and Deployment

Source: Internet
Author: User
Keywords dns dns server deployment dns server installation
DNS (Domain Name System) domain name system

In the Internet, the IP address is used to determine the computer's address. This type of digitally represented IP address is not easy to remember. In order to facilitate the management and distribution of network addresses, people have adopted the domain name system and introduced the concept of domain names. By establishing the mapping relationship between the IP address and the domain name for each host, users can avoid difficult-to-remember IP addresses and use domain names to uniquely identify computers on the network. The relationship between domain name and IP address is like the relationship between someone’s name and ID number. Obviously, remembering the name is much easier than remembering the ID number.


Packages required by the program: bind (DNS server software package), bind-utils (DNS test tools, including dig, host, nslookup, etc.), bind-chroot (security enhancement tools that make BIND run in a specified directory), caching -nameserver (basic configuration file for caching DNS server, it is recommended to install it)

The directory where the executable file is located: /usr/sbin/named (Rhel7) /etc/init.d/named (Rhel6)
The directory where the configuration file is located: /etc/named.conf
Directory where the zone configuration file is located: /var/named/xxx.zone

Install the DNS program: yum -y install bind*
Modify the main configuration file: /etc/named.conf
Add and modify the zone configuration file /var/named/xxx.zone
Modify file permissions: chown named:named /var/named/xxx.zone
Start the service and verify systemct start named; nslookup www.xie.com
Modify the main configuration file: /etc/named.conf

options {
        listen-on port 53 {any; }; //Modify the line
        listen-on-v6 port 53 {::1; };
        directory "/var/named";
        dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query {any; }; //Modify line
}
 
zone "." IN {//System custom root zone server, must have
        type hint;
        file "named.ca";
};
 
zone "xie.com." IN{ //Custom, add forward analysis
        type master; //Master-slave DNS
        file "xie.com.zone"; //Specify the zone configuration file name, under the /var/named/ directory
};
zone "10.168.192.in-addr.arpa" IN{ //Custom, add reverse analysis
        type master;
        file "xie.com.zone";
};
 
zone "mi.com." IN {//Add the resolution of another domain name
        type master;
        file "mi.com.zone"
}
Create xie.com.zone and mi.com.zone files in the /var/named/ directory, and configure as follows

// Configuration of xie.com.zone file
$TTL 1D
@ IN SOA www.xie.com. root.xie.com. (// @ represents this machine
                                        0; serial
                                        1D; refresh
                                        1H; retry
                                        1W; expire
                                        3H); minimum
        NS www.xie.com.
        MX 10 root.xie.com. //Mailbox
www IN A 192.168.10.100 //This must be written in the first entry! !
web IN A 192.168.10.110
root IN A 192.168.10.120
* IN A 192.168.10.130 //Add a default match, when none of the configuration files match, match this one
ftp IN CNAME www //Add an alias to www.xie.com ftp.xie.com
1 IN PTR web1.xie.com. //Add reverse resolution record 192.168.10.1 resolves to web1.xie.com
2 IN PTR web2.xie.com.
 
 
// Configuration of mi.com.zone file
 
$TTL 1D
@ IN SOA www.mi.com. root.mi.com. (
                                        0; serial
                                        1D; refresh
                                        1H; retry
                                        1W; expire
                                        3H); minimum
        NS www.mi.com.
        MX 10 root.mi.com.
www IN A 192.168.10.100
web IN A 192.168.10.200
  Construction of the master-slave DNS server:
On the basis of the above configuration, the main DNS server adds the following line to the main configuration file /etc/named.conf, which means that transfer is allowed

allow-transfer {192.168.10.10; }; // Allow the ip address from the DNS server
Then write which zone to synchronize which domain name from the DNS server, we only synchronize the domain name xie.com here, the file path for synchronization is /var/named/slaves by default

zone "xie.com." IN {
        type slave;
        file "slaves/xie.com.zone"; //Specify the configuration file directory
masters {192.168.10.124; }; //Specify the master DNS IP
};
zone "10.168.192.in-addr.arpa" IN{
        type slave;
        file "slaves/xie.com.zone";
        masters{ 192.168.10.128; };
};
After the configuration is complete, restart the named service: systemctl restart named, and then synchronize the domain configuration file: rndc reload

Forward DNS server configuration
The forwarding DNS server means that when you request DNS resolution from a DNS server, it forwards the DNS request to another DNS server

The forwarding DNS server also requires the bind package to be installed: yum -y install bind*

Then modify the main configuration file: /etc/named.conf

 option{
   listen-on port 53 {any; }; #modify
 
   allow-query {any; }; #modify
   
   forwarders {192.168.10.10; }; # Specify which DNS server you want to forward DNS requests to
}
Related Article

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.