First, what DNS is the?
DNS (Domain Name System acronym), the role is to store the correspondence between domain names and IP addresses. There are normally two computers to communicate the IP address.
Two, DNS server
Our computer wants to access a Web site, first of all to get with this ID address corresponding to the URL.
First, the machine must know the IP address of the DNS server, the DNS server in order to know what an IP address in the end yes.
IP address of the DNS server, there may be dynamic, assigned by the gateway every time, when the access mechanism called DHcp; there may be a fixed pre-specified address. Linunx inside the system, IP address, DNS server is saved in the /etc/resolv.conf
file
Third, the domain name hierarchy
How DNS servers know the IP address of each domain name it? The answer is hierarchical queries.
Please look carefully the previous example, the tail of each domain are more than a point.
For example, the domain name math.stackexchange.com
appears as math.stackexchange.com.
. This is not negligence, but the tail of all domain names, in fact, there is a root domain.
For example, www.example.com
the real domain name is www.example.com.root
abbreviated as www.example.com.
. Because the root domain name .root
is the same for all domain names, it is usually omitted.
Under a root domain, called "top-level domain" (top-level domain, abbreviated as the TLD), for example .com
, ; .net
then the next is called "sub-domains" one (second-level domain, abbreviated as the SLD), such as www.example.com
inside .example
this is a user-level domain can be registered; then the next level is the host name (host), such as www.example.com
inside www
, also called "third-level domains," which is at the user's own domain name which is assigned by the server, is users can arbitrarily assigned.
In summary, the domain name hierarchy is as follows.
主机名.次级域名.顶级域名.根域名 # 即 host.sld.tld.root
Fourth, the root name servers
DNS server based on the domain name hierarchy, grading query.
To be clear every level domain has its own NS record, NS record points to the domain name server-level domain names. These servers know all kinds of records at a domain name.
The so-called "hierarchical queries," is to start from the root domain, and then click Query NS records every level domain, until finally found the IP address, the process is as follows.
- From the "root name server" found "top-level domain server," the NS record and an A record (IP address)
- From the "top-level domain name server" found "secondary domain name server," the NS record and an A record (IP address)
- Found "Host Name" IP address from the "secondary domain name server."
A close look at the above process, you may find no mention of how DNS servers know the "root name server" IP address. The answer is "root name server" IP address and NS records generally will not change, so the built-in DNS server inside.
Here is a built-root name server IP addresses example .
The list above, lists the root domain ( .root
) of three NS records A.ROOT-SERVERS.NET
, B.ROOT-SERVERS.NET
and C.ROOT-SERVERS.NET
, as well as their IP addresses (ie record)A
, , .198.41.0.4
192.228.79.201
192.33.4.12
In addition, all records can be seen that the TTL value is 3,600,000 seconds, equivalent to 1,000 hours. That is to say, once every 1,000 hours to query the root name server list.
Currently, the group of a total of thirteen root name servers, from A.ROOT-SERVERS.NET
up to M.ROOT-SERVERS.NET
.