DNS Server Configuration
I. DNS Overview: DNS stands for the Domain Name System (DomainNameSystem) and is a computer and network service naming system that organizes domain layers. It is used to convert a domain name to an IP address that can be identified by the network, save the query results, and notify the client.
Ii. DNS query Process
The DNS query process refers to the process in which the client converts an IP address to an FQDN through the DNS server, converts an FQDN to an IP address, or queries an email server in a region.
1. Sort DNS queries by Query Method
A. recursive query: When the DNS server receives a query request, either a query success response or a query failure response is returned. Recursive queries generally occur between the DNS client and the DNS server.
B. Iterative query: the DNS server responds with the best results based on its own cache or region data. If the DNS server cannot be resolved, it may return a pointer. The Pointer Points to the DNS server with a lower-level domain name. Continue the process until you find the DNS server with the queried name, or until an error or timeout occurs. Iterative queries generally occur between DNS servers.
2. DNS query by query content category
A. forward query; domain name -- "IP"
B. Reverse query: IP ---- Domain Name
Iii. Install DNS
1. Configure the yum local source and use the group installation method.
2. Do not forget to install caching-nameserver.
Iv. Application Cases
DNS configuration troubleshooting method:
1. Check that the master configuration document named-checkconf is followed by the path and name of the master configuration document.
For example, under/var/named/chroot/, named-checkconf etc/named. conf
2. path and name of the region file detection tool named-checkzone
For example, the current file is in/var/named/chroot named-checkzone a.com var/named/a.com. db
3. view the log file (/var/log/messages) and find the cause of the error.
In addition, you must disable the firewall during testing,
1. Main scope and auxiliary Scope
Configuration Parameter: The domain name is a.com.
The primary domain IP address is 192.168.142.2;
The IP address of the secondary area is 192.168.142.20.
1) copy the master configuration file and configure it as follows:
The data of the primary dns must be added to the primary configuration file and can be transferred to the specified dns server (secondary region)
2) edit the named. rfc1912.zones file, as shown in Add:
3) copy and modify the region file template.
4) restart the dns Service
5) Now, the basic configuration of the main region is complete.
6) The files in the secondary area are basically the same as those in the primary area, that is, you no longer need to add allow-transfer {}; in the options block, and edit the named. rfc1912.zones file, as shown in Add:
Make sure that the default "allow-update {none;};" item will be allowed to be updated and deleted soon. There is also the storage location of the file, which can also be stored in other directories, however, you must ensure that the owner and owner Group of the stored directory are named. Otherwise, BIND will not be able to write the DNS information transmitted from the main region into the file.
7) when you start the dns service, you will find that the.com. db file is generated under slaves. Pay attention to the size of the value and make comparisons later,
8) test phase: add several records to the primary region file. For example, observe the changes of the secondary DNS. Note: after each data modification in the primary region, the serial number in the SOA record needs to be increased, otherwise the secondary region will not be able to know that the record in the primary region has changed.
9) set the dns of the test machine as the secondary dns,
10) test with nslookup and find that the newly added records are not correctly parsed, because the refresh set by dns takes 2 minutes. After a while, we can see a.com. the db file has been increased, and those records
It has also been added to the area file of the secondary area.
11) the newly added smtp.a.com can be correctly parsed on the test machine.
2. Forwarding and Delegation
Experiment Description: A company is headquartered in Beijing and its primary domain name is qq.com. The subdomain bj.qq.com in Beijing is also built on the dns server in the primary domain, the domain name in the main region can be resolved normally if the sub-domain sh.qq.com located in Shanghai is located far away, the domain name of the subdomain needs to be queried through the primary DNS on the host in Beijing through forwarding. The experiment is as follows:
Note: 1) forwarding:
A. Complete forwarding: All DNS queries on the client are recursively forwarded to the specified DNS server,
B. Conditional forwarding: Forward queries with the specified DNS suffix to the specified DNS server;
2) delegate: In BIND, you can delegate the query of a subdomain to another DNS server.
Configuration process:
1) modify the dns master configuration file as in Case 1 and add the following in the named. rfc1912.zones file:
2) Add the region file and make the following modifications to the main domain qq.com:
Beijing subdomain bj.qq.com:
3) Restart dns. Now the basic configuration of the dns master region is complete. The following is the configuration of the Shanghai subdomain DNS:
4) Configure forwarding for the subdomain. Add "forwareders {192.168.142.2 ;};" to the main configuration file for full forwarding:
You can also add the statement in the example in named. rfc1912.zones to implement conditional forwarding:
5) modify the 2IP address of the test server to 192.168.142.6/24, and change the DNS address to 192.168.142.20, that is, the DNS address of the subdomain.
6) Use nslookup to view details, such:
7) Assign configuration. Add the following statement to the region file of the primary region to delegate the query of the sh.qq.com domain to the Shanghai subdomain 192.168.142.20,
8) test, modify the IP address of Server 1 to 192.168.142.5, and use DNS as the primary DNS: 192.168.142.2
9) Run nslookup in cmd to test the function, for example:
10) the test ends normally.
Note: In the above cases, reverse scopes are not configured to simplify the experiment steps. The understanding of reverse scopes will be described separately later.
3. Reverse region Configuration
Experiment parameter: The forward region is abc.com and the IP address segment is 192.168.142.0/24,
DNS Server IP Address: 192.168.142.20
Add www host 192.168.142.8,
1) correctly modify the main configuration file,
2) EDIT named. rfc1912.zones and add the following statement (forward and reverse ):
3) copy and edit the template file,
Forward region file abc.com. zone, for example:
The reverse region file 14.0192.zone is shown as follows:
4) Test the syntax of the region file and restart the service:
5) test and modify the IP address of the test machine as follows:
6) run the nslookup command in cmd, as shown in the following figure:
7) the test is normal and the experiment is over.
This article from "Liu Yuan's blog" blog, please be sure to keep this source http://liuyuan51.blog.51cto.com/5971950/1030126