DNS (Domain Name System) is a distributed database that maps domain names and IP addresses on the Internet, allowing users to access the Internet more conveniently, instead of remembering the number of IP address strings that can be directly read by machines. The process of obtaining the IP address corresponding to the host name through the host name is called domain name resolution (or host name resolution ). The DNS protocol runs on the UDP protocol and uses the port number 53.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/44/85/wKiom1Ph3gezYgxWAAAL4EQBpms838.png "Title =" DNS principle. PNG "alt =" wkiom1ph3gezygxwaaal4eqbpms838.png "/>
As a hierarchical and distributed database, the domain name system contains various types of data, including host names and domain names. The name in the DNS database forms a layered tree structure called the domain namespace. The fully qualified domain name (FQDN) uniquely identifies the host location in the DNS Hierarchy Tree and separates the names of the hosts referenced from the root using the specified path midpoint.
How DNS domain name space is organized
Type
|
Description |
Example |
Root Domain
|
When using a DNS domain name, it is required that the domain name is located at the root or higher level by the end (.). |
The name at the end of a single or period. |
Top-level domain
|
Indicates the name type used by a country or region for organization. |
. Com |
Second-level domain |
Registration name used by an individual or an ancestor on the Internet |
QQ.com 163.com |
Subdomain |
A domain name derived from a registered second-level domain name |
Aq.qq.com |
Alias |
The leftmost tag of the DNS domain name identifies a specific host on the network |
|
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/97/wKioL1Ph_c2CswbBAAFhcN3wXA4351.jpg "Title =" 201307141950351941.jpg" alt = "wkiol1ph_c2cswbbaafhcn3wxa4351.jpg"/>
Resource Record: RR (Resource Record)
Type concept: attributes used for parsing this record
SOA: the initial Authorization Record. Only one region file can exist;
NS: Name Server
MX: email exchange. The MX record has a priority attribute (0-99 );
A: FQDN --> IP address, dedicated to forward resolution Library
PTR: IP --> FQDN, used for reverse resolution Library
Aaaa: FQDN --> IPv6, dedicated to forward resolution Library
Cname: official name
Resource Record type:
SOA: Name region name, which can be abbreviated as @ value: FQDN of the primary DNS server, or the region name of the current region;
Format
@ In SOA ns.magedu.com. admin.magedu.com .(
Serial number; the version number of the Resolution database, for example, 2014080401
Refresh time; interval of periodic Synchronization
Retry time; Retry Interval
Expire time; expiration time
Negative answer TTL; Unified cache duration of negative answers
NS name: Region name value: FQDN of the DNS server
Format
@ In NS ns.magedu.com.
If there are multiple NS servers, each of them must have corresponding NS records;
For forward parsing files, each ns fqdn should have a record;
MX name region name value: FQDN of the email server
Format
@ In MX 10 mail.magedu.com.
If there are multiple MX servers, each one must have a corresponding MX record; however, each MX record also has a priority attribute.
For forward parsing files, each ns fqdn should have a record;
A name FQDN value: IP
Cname name FQDN value: FQDN
PTR: pointer
Name: reverse Host IP address and suffix in-addr.arpa, such as 172.16.100.7/16, network address is 172.16, host address is 100.7, its name is 7.100.in-ADDR. ARPA.
Value: FQDN
DNS query
DNS resolution mainly involves recursive queries. When the corresponding domain name and IP address cannot be found in the cache of a DNS server, the system automatically jumps to the next step and searches through the next DNS server.
Host-local NDS server-DNS root server
Bind of DNS
Service Script:/etc/rc. d/init. d/named
Main configuration file:/etc/named. conf,/etc/named. rfc1912.zones
Region resolution library file:/var/named/zone_name.zone
1. After installing the BIND Program
Modify the main configuration file:
Define Region
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/44/93/wKiom1Ph9bbA9Y7YAABKxOKTkQc998.png "style =" float: none; "Title =" named. conf. PNG "alt =" wkiom1ph9bba9y7yaabkxoktkqc998.png "/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/93/wKioL1Ph9s_Cu1GFAAAe4cwUA_k233.png "style =" float: none; "Title =" named. RFC. PNG "alt =" wkiol1ph9s_cu1gfaaae4cwua_k233.png "/>
3. Provide a resolution database for each region
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/A8/wKioL1PiJROi5wGlAAAnPCzvOC4720.png "Title =" fengshi 111111111111.png" alt = "wkiol1pijroi5wglaaanpczvoc4720.png"/>
After
# Service named start
Available for testing
1. Host-T rrtype name [server]
2. Dig-T type name @ Server
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/A8/wKioL1PiJWfzA28CAAAU74r09Jw479.png "Title =" qqqqqqqqqqqqqqqqqqqqqqqqqqqq. PNG "alt =" wkiol1pijwfza28caaau74r09425479.png "/>
Master/Slave configurations of DNS servers
1. modify the configuration file on the master server as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/44/A7/wKiom1PiIwLwQ55wAAAhu2nkf8A116.png "Title =" Capture. PNG "alt =" wkiom1piiwlwq55waaahu2nkf8a116.png "/>
2. Create test. Zone
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/44/A8/wKiom1PiI0uhhKFaAAAmWBEwbm0977.png "Title =" test. Zone. PNG "alt =" wkiom1pii0uhhkfaaaamwbewbm0977.png "/>
3. Set files on the slave server
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/44/A8/wKioL1PiJK_w91OAAAAc8tffkcY518.png "Title =" aaaaaaaaaa. PNG "alt =" wkiol1pijk_w91oaaaac8tffkcy518.png "/>
4. Results
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/A8/wKiom1PiI8WThdEiAAAFE76xEAI179.png "Title =" jieguo. PNG "alt =" wkiom1pii8wthdeiaaafe76xeai179.png "/>