1. What is DNS
DNS: Domain Name Service, which is a hierarchical computer and network Service naming system that implements name resolution (HOSTNAME<-->IP). which resolves the IP address by the computer name is called forward parsing, the IP address to resolve the computer name is called reverse resolution.
DNS uses the C/s architecture, and the service listens on port 53rd of the host's tcp/udp. Transport Layer protocol UDP is used for domain name resolution, TCP for zone transfer
Local name resolution file: Hosts (host limited time available)
/etc/hosts
%windows%/system32/drivers/etc/hosts
2.dns Architecture
A typical DNS service consists of 4 parts, as shown in:
1. DNS domain namespace: It specifies the hierarchy of domains used for the organization name
2. Resource record (RR): It maps DNS domain names to specific types of resource information for use when registering or resolving names in the namespace. In a Linux system, each line in the "Name resolution library (text file, located in/var/named/)" is typically called a resource record.
3. DNS server: Name query that stores and answers resource records
4. DNS Client (resolver): It queries the search from the server and resolves the name to the resource record type specified in the query.
Root domains: root domain, the entire namespace, by a "." Said. There are 13 groups of DNS root servers worldwide
First-level domain (top-level domain): top-level domain
Organizational domain:. com,. org,. NET,. mil,. edu,. gov
Country domains:. cn,. US,. UK,. JP,. TW,. HK,. IQ,. ir
Reverse domain:. in-addr.arpa
Second-level domain: company, organization, personal use; Sohu,.amazon
Host: such as Www,mail, the hostname is our own definition
用户主机要访问地址为www.XXX.com的主机6,解析步骤:
1, the DNS domain 1, the user's resolution request sent to a (this is the user host configuration of the network properties of the DNS pointing);
2, a of course, do not know www.XXX.com corresponding IP, so Schongen request; root see the name of the last is COM, so return a is the COM corresponding server IP;
3, a based on IP to find a level domain COM server; COM see the domain name is xxx, so according to record, return a is the IP of Server B;
4, a according to IP find server B; Server B sees the host WWW to access, so according to the record, return a is the host WWW ip;
5, a return to the user host www.XXX.com address;
6. User host Access Www.XXX.com namespace: It specifies the hierarchy of the domain used for the organization name
2. Resource record (RR): It maps DNS domain names to specific types of resource information for use when registering or resolving names in the namespace. In a Linux system, each line in the "Name resolution library (text file, located in/var/named/)" is typically called a resource record.
3. DNS server: Name query that stores and answers resource records
4. DNS Client (resolver): It queries the search from the server and resolves the name to the resource record type specified in the query.
(1) Recursive query: The client obtains the result either succeeds or fails. (The local client interacts directly with the DNS service, and the requested DNS server must give the final answer)
(2) Iterative query: The server returns the local DNS with the relevant reference answer. (The DNS service interacts with the DNS service to get a reference answer)
(3) Root hints function
In general, queries between DNS servers are iterative. As shown, if you are querying www.microsoft.com (the microsoft.com domain is not the local DNS-responsible zone), then local DNS needs to iterate over the query (the iterative query starts from the root domain, so that local DNS must know the IP address of the root domain). The root Hints feature allows the local DNS server to query the root domain DNS server.
3.dns parsing
Forward resolution: FQDN-to-IP, one name can correspond to multiple IPs
Reverse resolution: IP-to-FQDN, one IP can also correspond to multiple names
Forward parsing and reverse parsing using one parse library, respectively
In a Linux system, the DNS name resolution library is typically a text file (which can contain only resource records and macro definitions) and is typically saved in the/var/named/directory. Each line of the text file is called a resource record.
Each name-resolution library is called a zone
Description: regional (zone) and domain differences
Zone Zone is a physical concept, and an area is a DNS resolution library
Domain is a logical concept and a domain corresponds to a DNS domain name space
Forward parsing and reverse parsing use different parsing libraries, a DNS configuration of forward parsing libraries and reverse parsing libraries means that they contain two zones (forward zone and reverse zone)
4.dns Server Type
Primary DNS Server
From a DNS server
Cache server: Do not parse any zone, but allow recursion
Master-Slave DNS server parsing library file synchronization process: zone transfer (single direction transfer), based on 53/TCP
Full zone transfer: AXFR
Incremental zone transfer: IXFR
Periodic check + notifications
5. Zone resolution Library
resource record: RR (resource record)
㈠ resource record type: Represents the attribute resolved by this record
Soa:start of authority, start authorization record, one zone file can only have one;
Ns:name Server
Mx:mail exchange, mail exchanger, MX record has a priority attribute (0-99);
A:fqdn-IP, dedicated to the Forward parsing library
Ptr:ip-to-FQDN, Dedicated to reverse parse library
Aaaa:fqdn-IPV6, dedicated to forward parsing library
Cname:canonical name, official name
FQDN: Fully qualified domain name (full qualified name)
㈡ resource record format:
name [TTL] in rrtype value #ttl为DNS缓存时长
①soa:start of authority, the type of the first record of any parsing file must be SOA and a zone file can have only one name: a zone, usually abbreviated as @ value: The FQDN of the primary DNS server, or the zone of the current zone Name; for example: @ in SOA ns.magedu.com. Admin.magedu.com. (e-mail) (serial number #解析库的版本号, for example 2014080401; If you have configuration master and slave, each time you modify the resolution file, update the version numbers to synchronize from the server Refresh Time #主从服务器周期性同步的时间间隔 retry times #主服务器未响应从服务器, expire from the server retry interval #主服务器一直无 Response, negative answer TTL #否定答案 (no result) for the time of expiration of the server resolution Library Description: @ Represents the currently defined region, as the above example, should be written as magedu.c Om. Because @ in the Analytic library has special meaning, so the email address can not be used, and use. Instead, as in the above admin.magedu.com. ②ns:name server name: The FQDN of the zone name Value:dns Server for example: @ in NS ns.magedu.com. Note: If you have more than one NS server, each must have a corresponding NS record; For a forward parsing file, each NS FQDN should have an a record; ③mx:mail EXchanger name: Zone name Val UE: The FQDN of the mail server for example: @ in MX ten mail.magedu.com. @ in MX mail2.magedu.com. Note: If you have more than one MX server, each must have a corresponding MX record, but each MX record has a priority attribute (0-99) ④a:address Name:fqdn Value:ip For example: www.magedu.com. In A 1.1.1.1 www.magedu.com. In A 1.1.1.2 pop3.magedu.com. In A 1.1.1.3 imap.magedu.com. In A 1.1.1.3: resolves all requests that do not match the resource record to the specified IP address *.magedu.com. In A 1.1.1.1 use: ⑴ can allow the domain name to support unlimited subdomains, ⑵ prevent the user from wrong input caused by the site can not access the problem; for example Wwww.magedu.com⑤aaaa:ipv6 ip⑥c Name:canonical Name Name:fqdn Value:fqdn for example: www.magedu.com. In A 1.1.1.5 web.magedu.com. In CNAME www.magedu.com. #前者是后者的别名 ⑦ptr:pointer, Reverse parse Name: reverse IP address plus suffix. in-addr.arpa., for example 172.16.100.7, whose name is 7.100.16.172.in-addr.arpa. Value:fqdn For example: 7.100.16.172.in-addr.arpa. In PTR www.magedu.com.
Linux-dns basic knowledge and simple configuration of BIND-1