Website construction (2)-DNS and DNS resolution

Source: Internet
Author: User
Tags domain server net domain

Website construction (2)-DNS and DNS resolution

The previous article mentioned the domain name and the classification, selection and purchase of the domain name. However, with the domain name, your website cannot be accessed, because the communication between hosts on the internet is accessed by a unique IP address. To know the IP address of a domain name, DNS resolution is required.

What is DNS

DNSDomain Name System (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.

Communication between computers on the network is done through IP addresses, but IP addresses are not easy to remember. We need a name that is easy to remember to recognize each computer. This is the domain name, the domain name maintenance system is called the domain name system,Domain Name SystemIt is actually a name system. The domain name is unique and the IP address is unique. If you want a domain name to know its corresponding IP address, you need a ing from the domain name to the IP address. The search process for IP addresses from domain names is DNS resolution. The DNS server that performs DNS resolution is called the DNS server, and the DNS server acts as the "translator, translate a domain name into an IP address.

DNS resolution principles

DNS resolution is the process of finding a host through a domain name. There are three steps in the search process:

Local query (client DNS parser) Client-to-Server Query server-to-Server Query

 

Main DNS resolution process 1. enter the blog.csdn.net domain name in the browser for local query. The operating system first checks whether the local hosts file has this URL ing relationship. If yes, it first calls this IP address ing to complete domain name resolution.
The local hosts file in Win7 is in C: \ Windows \ System32 \ drivers \ etc \ hosts, and in Linux:./etc/hosts. If there is no hosting for this domain name in hosts, find the local DNS parser cache and check whether there is this URL ing relationship. If yes, return directly to complete domain name resolution. If there is no URL ing between hosts and the cache of the local DNS parser, first find the preferred DNS server set in the TCP/IP parameter, here we call it a local DNS Server (that is, the DNS Server in the middle) and find it on the local DNS Server.
In Win7, the TCP/IP parameters are set in Control Panel \ network and Internet \ Network Connection \ Local Link \ properties \ Network \ Internet Protocol Version 4 (TCP/IPv4)


DNS settings 2. when the client queries the local DNS server and receives the query, if the domain name to be queried is included in the resources in the local configuration area, the resolution result is returned to the client to complete domain name resolution, this resolution is authoritative. If the domain name to be queried is not resolved by the local DNS server, but the server has cached the URL ing relationship, the IP address ing is called to complete domain name resolution. This resolution is not authoritative. If the file and cache resolution in the local region of the local DNS server are invalid, the query is performed based on the settings of the local DNS server (whether to set the forwarder. 3. Server-to-Server Query

If the forwarding mode is not used, the local DNS sends the request to 13 root DNS servers. After receiving the request, the root DNS server determines the domain name (. com) who is responsible for authorization management, and will return an IP address responsible for the top-level domain name server. After receiving the IP address information, the local DNS server will contact the server responsible for the. com domain. After the server in charge of the. net domain receives the request, if it cannot be resolved by itself, it will find a next-level DNS server address (csdn.net) Managing the. net domain to the local DNS server. When the local DNS server receives this address, it will find the csdn.net Domain Server and repeat the above action to query until the blog.csdn.net host is found.
There are 386 root servers around the world, numbered from A to M, with 13 numbers. root servers with the same number use the same IP address, and 386 root servers use only 13 IP addresses in total, therefore, it can defend against Distributed Denial of Service (DDoS) attacks ). There are two root server images numbered L in Beijing in mainland China, each numbered F, I, and J. There are five images in total, so the fault mentioned above should be a domestic DNS root domain image fault. Because there are only 13 IP addresses, it is often considered that there are only 13 root domain name servers, one Primary Root Domain Name Server, and the other 12 are used as the root domain name server. Reference self-http://www.ahlinux.com/server/dns/7763.html

If the forwarding mode is used, the local DNS server will forward the request to the upper-level DNS server (csdn.net) for resolution. If the upper-level server cannot resolve the request, will transfer the transfer request to the upper-level (.. net) or find the root DNS server. Whether the local DNS server uses the forwarding mode or the non-forwarding mode, the result is finally returned to the local DNS server, and then the DNS server returns the result to the client.

Recursive query and iterative Query

Recursive query

Generally, recursive queries are used for queries from a host to a Local Domain Name Server. The so-called recursive query is: if the local Domain Name Server asked by the host does not know the IP address of the domain name to be queried, then the Local Domain Name Server takes the DNS customer's identity, send a query request message to another Root Domain Name Server (that is, continue querying for the host) instead of letting the host perform the next query on its own. Therefore, the query result returned by the recursive query is either the IP address to be queried, or an error is returned, indicating that the required IP address cannot be queried.

Iterative Query

Iterative query by the Local Domain Name Server to the root domain name server. Iterative query features: when the root domain name server receives an iterative query request message from the Local Domain Name Server, it either gives the IP address to be queried or tells the local server: "Which Domain Name Server should you query next ". Then let the local server perform subsequent queries. The Root Domain Name Server usually tells the Local Domain Name Server the IP address of the top-level domain name server that you know, so that the local Domain Name Server can query the top-level domain name server again. After receiving a query request from the Local Domain Name Server, the top-level domain name server either gives the IP address to be queried or tells the local server which permission Domain Name Server should be queried next. Finally, the IP address to be resolved or an error is reported, and the result is returned to the host that initiates the query.

How to optimize DNS

Generally, domain name service providers or server providers provide free DNS services. However, in many cases, these free DNS servers are slow, so they can be optimized as follows:

(1) Increase the number of DNS servers

Reduce the server pressure. When the number of DNS requests to be processed by the server is small, the speed will be faster;

(2) distributed DNS servers across China

The user's network access speed is related to the distance from the user's computer to the server. If the user can access the server in the nearest province, the DNS resolution speed can be accelerated;

(3) Identify the IP address of the line feedback

When the user's network line is the same as the server's network line, the speed is faster, but not the same. For example, if the user uses a telecom line but the server is a Unicom line, this will lead to a decrease in the speed of user access to the website. If you can identify the user access line and feedback the corresponding IP address, the Website access will be accelerated.

Optimization tools provided by DNSPod

In our article about website construction, we mentioned that DNSPod is China's largest third-party Domain Name Service Provider, ranking fourth in the world. Its basic business is DNS resolution, it provides us with two free DNS optimization tools: Local DNS optimization and domain name health diagnostics.

 



Local DNS Optimization

Domain name health diagnostics

We can discover and solve some problems through its prompts.

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.