Introduction to DNS domain name resolution system

Source: Internet
Author: User
Tags mail exchange nameserver


DNS domain name resolution

The purpose of the domain name resolution is to convert the website name that users use to the TCP/IP protocol, and hostname is just convenient for people to remember, after all, IP is a pure digital address to the user is very unfriendly. However, when using TCP/IP communication, the computer is implemented through the IP address +port port number, so when we type a host name in the browser, we eventually need to convert it to the form of an IP address to actually access the source server.

/etc/hosts: Query by entering the IP of the host name in the client-side file; DNS system: The use of additional DNS services allows the client side to obtain the destination host's IP through name resolution.

A URL address is as follows, which includes several parts: protocol name, host name, port number, and so on.


Http://www.google.com.hk:80
-------------------------------
Scheme host name Domain name port
HTTP Google com.hk is default value




Hierarchy of domain names: top domain names such as. com,. mil,. NET, org,. gov,. edu, etc. or country code (such as. cn,. JP,. UK,. us, etc.).

DNS uses a hierarchical architecture, and any DNS server records only the IP address of the next-tier host name.
In the case of HTTP://WWW.GOOGLE.COM.HK:80, the browser accesses a DNS server based on the client's settings (assuming that the name is X), and the DNS x server first finds itself with no corresponding records, and if the retrieved IP is returned directly to the client, Otherwise, further queries will be made to other DNS servers, the process being as follows:
1, first to the root host query, find this is. HK this machine data;
2, to the. HK query, and the machine managed only a few hosts, such as EDU.HK, com.hk, gov.hk, etc., after a comparison found that we want to be. COM.HK network segment, so at this time. HK tells us to go. com.hk This network segment of the host where query;
3, this step by step down,. com.hk can find the host IP address that manages GOOGLE.COM.HK;

4, after Google's IP address, the DNS x server will not be the next time someone inquires google.com.hk again such a process, because it is too waste of time and network bandwidth. The DNS x server now records a copy of google.com.hk IP information in its own cache so that the next time someone requests a query for the same host name, the result returns to the client end.

Of course, the memory in the cache data is time, when the DNS settings after the memory time (such as 24 hours), the record will be released. In the cache memory record of DNS, due to the time limit, when the source server name is modified in DNS, because the old information is still memory in the memory cache of other DNS hosts, it is possible to query the source server name with someone else's DNS host to get the previous old information, which is usually about 2 days.



The port number for DNS listening is 53 (which can be queried in the/etc/services file), which is queried with the faster data transfer Protocol of UDP. But in case there is no way to query the full information, it will again be queried with the TCP protocol, so start DNS daemon (that is, named), will also start TCP and UDP port 53rd.

The most important function of DNS system is to check the host name and IP, because the computer only knows the IP address on the network, so, generally speaking, the process of locating IP by host name is positive solution; The host name is inverse solution by IP query.
The primary configuration file for DNS is/etc/named.conf, which records the profile name of each zone. In fact, hostname's correspondence with IP is recorded in each zone configuration file.
/etc/named.conf: Configuration file;
/etc/sysconfig/named: This file controls whether to start the chroot and additional parameters, which are read by the/etc/init.d/named when it is started;
/var/named/: The database file is placed in the secondary directory by default;
/var/run/named:named The pid-file is placed in this directory by default when the program executes;


A description of the DNS-related configuration file is reproduced below:

. /etc/host.conf
When DNS domain name resolution and/etc/hosts host table mechanisms exist in the system, the/etc/host.conf is determined by the host name interpretation order. Example:
Order Hosts,bind #名称解释顺序
Multi on #允许主机拥有多个IP地址
Nospoof on #禁止IP地址欺骗
The order is a keyword, defined first with the native hosts host table for name interpretation, and, if not explained, search for the Bind name server (DNS).

. /etc/resolv.conf
This file is a configuration file for DNS domain name resolution, which is simple in format, preceded by a keyword, followed by configuration parameters. The key words of resolv.conf are mainly four, respectively:
NameServer #定义DNS服务器的IP地址
Domain #定义本地域名
Search #定义域名的搜索列表
Sortlist #对返回的域名进行排序
An example of/etc/resolv.conf:
Domain ringkee.com
Search Www.ringkee.com ringkee.com
NameServer 202.96.128.86
NameServer 202.96.128.166
The most important is the nameserver keyword, if you do not specify nameserver can not find the DNS server, other keywords are optional.

. /etc/hosts
Set the IP address and the host name corresponding table, which can be used to explain the host name. Such as:
#格式: IP Address host name alias
127.0.0.1 localhost Localhost.localdomain
192.168.1.1 Debian Debian
192.168.0.2 t02 T02.tiger
192.168.0.4 t04 T04.tiger


./etc/name.conf
Generated by named-bootconf.pl
Options {
Directory "/var/named";
/*
* If There is a firewall between for you and nameservers for you want
* To talk to, your might need to uncomment the Query-source
* directive below. Previous versions of BIND always asked
* Questions using port, but BIND 8.1 uses an unprivileged
* Port by default.
*/
Query-source address * port 53;
};
//
A caching only nameserver config
//
Zone "." in {
Type hint;
File "named.ca";
};
Zone "0.0.127.in-addr.arpa" in {
Type master;
File "Named.local";
allow-update {none;};
};
This section is the original content of the named.conf file that was automatically generated by the system after you installed the BIND software. directory specifies that DNS record files are stored in/var/named. The text at the beginning of the "//" is an explanatory text, without any care. The next two "zone" statements define the root of the DNS server and the corresponding reverse query domain, and indicate that the root record file is "name.ca", and that the root's reverse query domain's record file is "Named.local". These two record files are also brought by the system, do not have to change it. Named.conf This part of the file, we don't have to change it.
But we can add a row under "Diretory": Forwarders {202.96.134.133;}. 202.96.134.133 is the address of my DNS server for telecommunications, the forwarders parameter indicates the server on which the IP is located as an alternate DNS server. This means that a host that is unable to resolve the DNS of this computer is sent to this alternate DNS server for resolution.
Zone "Zrs.com" in {
Type master;
File "named.zrs.com";
allow-update {none;};
};
Zone "0.0.10.in-addr.arpa" in {
Type master;
File "Named.zrs.com.rev";
allow-update {none;};
};
This part is added by hand. Defines the domain of "zrs.com" and the corresponding Reverse query field. "Type Master" indicates that this computer is the primary DNS server (primary name server) for both the "zrs.com" and "0.0.10.in-addr.arpa" domains. "Named.zrs.com" and "Named.zrs.com.rev" are log files for the domain. These two files are created by themselves, so let's take a look at the two files below.

The


./var/named/naemd.***.com
Resource record file, located in the/var/named directory. This directory is defined in named.conf. The contents of the
1, named.zrs.com file are as follows:
@ in SOA netfinity.zrs.com. root.netfinity.zrs.com. (
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
in NS netfinity.zrs.com.
In MX ten netfinity.zrs.com.
Netfinity in a 10.0.0.211
Lily in a 10.0.0.139
www. CNAME netfinity.zrs.com.
POP3 in CNAME netfinity.zrs.com.
SMTP in CNAME netfinity.zrs.com.
There are 5 types of records in this record file. SOA is the acronym for the start of authorization (start of authority), followed by the hostname of your DNS server, "netfinity.zrs.com." (Note the small dot behind the host name.) The host name that appears in the record file, remember to add this each small dot. NS is a name server resource record that indicates the name server in the domain, and this is the DNS server. MX is a mail exchange resource record that indicates the mail server for this domain. You can write multiple MX records, indicating multiple mail servers, priority levels are determined by the number of MX, and the smaller the number, the higher the mail server priority. A is the host record, the host and IP address corresponding. CNAME is an alias record that gives a different name to a host, such as
Www.zrs.com
, pop3.zrs.com is actually pointing to the same host netfinity.zrs.com.


./var/named/naemd.***.com.rev
Named.zrs.com.rev File Contents:
@ in SOA netfinity.zrs.com. Root.netfinity.zrs.com. (
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In NS netfinity.zrs.com.
211 in PTR netfinity.zrs.com.
139 in PTR lily.zrs.com.
This is the reverse domain record file for "zrs.com", which gives the DNS server the service to look up the host name by IP address. The PTR record corresponds to the IP and host name. Because some programs will require a reverse query, it is best not to omit the log file for the reverse query domain.
So far, you have successfully configured a DNS server to parse the domain of "zrs.com".


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.