URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

Computer network, one of the compulsory subjects for computer majors, is a professional course. However, many people except enter the browser, enter the URL, and then press Enter to see the page, and then operate it, basically have not paid much attention to its principle, but , After you hit enter, a lot of things really happened inside the network, but you do n’t know, today, I will take you to unlock the mystery of the network

 

1. One question

Before pointing out this problem, we must first clarify the following points:

  • All data on the Internet is stored on the host (server)
  • All hosts on the Internet have unique IP addresses
  • The communication between any two hosts in the Internet is realized by IP address

 

So after understanding the above, we take the simplest communication method of two hosts-Internet access as an example to explain what this doubt is for everyone!

 

Everyone in the 21st century should be familiar with the process of surfing the Internet (I do n’t know if anyone uses this term). The essence of our Internet access is to obtain the data on the host corresponding to the URL and display it on the user ’s host (on the browser) We should suspect a problem:

 

The communication between any two hosts on the Internet is based on the IP address, and our Internet access is only the URL entered, not the IP address. How can we find the other host and obtain its data?

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

A question

Therefore, there must be a mechanism to resolve the URL into an IP address, and then communicate through the IP address! This mechanism is also the main thread that runs through all the technical knowledge in this article!

 

2. Website

 

1. What is the URL?

 

A web address, also known as a domain name, also known as a URL, is a name used by Internet users to identify a host. The name is unique and hierarchical, and can literally represent the host ’s account number, function, nature, region or organization, and is convenient for all Internet User memory and use!

 

URL, that is, Uniform Resource Locator, a uniform resource locator, is used to indicate the server of the Internet host and the specific web page location. The URL composition strategy and examples are as follows:

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

URL composition and examples

Features: Web site naming follows Internet domain name rules and is easy to manage, including allocation, confirmation, and recovery, and is bound to the host's IP address at the same time. When users access the domain name, they can efficiently map the web address to the IP address. (See below for details).

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

URL

2. What problem does the appearance of the URL solve?

 

The emergence of URL / domain name / URL solves the following two problems:

  • Question 1: The IP address is the unified addressing mode of all hosts in the Internet. Using the IP address can directly access the host data and resources on the Internet, but because the IP address is just a string of data, it has no practical significance, causing all Internet users to remember difficult.
  • Question 2: In the Internet architecture, almost all application-layer software does not use IP addresses to access host resources in the Internet, but requires users to enter a meaningful host name to access the corresponding host.
  •  

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

IP address memory is difficult

3. The structure of the website

 

The above-mentioned host name, that is, the naming of the URL / domain name follows a certain rule, which is formulated by the "name management organization" in the Internet, namely the domain name system DNS. Here first introduce the composition of the following URL:

 

A host domain name on the Internet is composed of all levels of domain names to which it belongs and its own name (that is, it is composed of sub-domain names), the level increases from left to right, the top-most domain name is on the far right, and the host's own name is on the far left. Subdomains are separated by ".", The common format is as follows:

 

主机名.机构名.网络名.顶级域名 
 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

China University of Science and Technology Domain Name Composition

 

The following will introduce the domain name system DNS mentioned above in detail, including what problems are solved by the birth of DNS, the history of domain name development, domain name hierarchy, some top-level domain name objects, domain name servers, domain name resolution process and IP technology development!

 

3. DNS Domain Name System

 

1. What is DNS?

 

DNS, written in English as Domain Name System, meaning Chinese as domain name system, is a distributed database that provides mapping between domain names and IP addresses on the Internet.

 

2. History of DNS

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

History of DNS

 

3. What problem does DNS solve?

 

As mentioned above, the DNS domain name system is a host domain name management system on the Internet, acting as an "administrator"! Before the birth of DNS (in the ARPANET period), each host on the Internet used a file to record all host names And its IP address, this file is hosts.txt (now the hosts file, no suffix), all hosts must regularly update the file from the corresponding site, used to synchronize the addition, change, disappearance of hosts in the Internet.

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

Contents of hosts file

It is conceivable that as the number of hosts on the Internet increases, the hosts file will become larger and larger, the difficulty of maintaining and updating is increasing, and the host names frequently conflict. In order to solve this problem, the DNS domain name system was introduced in 1983 .

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

What problem does DNS solve

 

4. DNS domain name hierarchy

 

DNS is a hierarchical tree structure. Each layer is composed of domains. The meaning of domains is as follows:

  • The domain represents an area, a range
  • Each domain can accommodate a large number of hosts
  • Each host must have its own domain, but not necessarily its own domain name address
  • The DNS standard stipulates that the length of a single domain name is generally within 63 characters, with a maximum of 255 characters
  • The DNS standard stipulates that the characters in the domain name are limited to 26 letters (case-insensitive), numbers, and hyphens "-" (cannot be used as the first letter and the last letter of the subdomain name)
  • The server where the domain is located is called a domain name server, which is mainly used to map domain names to IP addresses (see below for details)
  •  

The domain name tree of DNS is composed of root domain, top-level domain, second-level domain and its sub-domains. Its structure and examples are as follows:

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

Domain name structure

The following describes each domain at a time:

  • The root domain is managed by the Internet Network Information Center (InterNIC). It is indicated by a dot "." And has no name. It is the highest-level domain in the domain name system. The standard domain name should include the root domain "." At the end, but the root is actually used. Domains are omitted, so there is no "." At the end of common URLs.
  • Top-level domains (Top-Level Domains = TLD), which belong to the root domain, are the next-level domains next to the root domain, and are composed of the national top-level domain (ccTLD) and the general top-level domain (gTLD). There are 243 national top-level domains (the total number of countries and regions in the world), and the number of generic top-level domains, also called international domain names, is gradually increasing with the development of the Internet, and the theory will reach an infinite number. The following table lists the common gTLDs:
  •  

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

GTLD

  • Second-level domain, the only name officially registered for organizations and individuals, such as Amazon, IBM, Microsoft's official website (headline can not bring the URL), the words "amazon" "ibm" "microsoft" is the second-level domain name registered by these companies .
  • Sub-domains below the second-level domain. Organizations in the second-level domain can further divide the sub-domains as needed, such as the sales subdomain for sales departments and the business subdomain for business departments.
  •  

As mentioned above, the appearance of domain names is to solve the problem of users' memory difficulties. In fact, domain names cannot be used for communication between hosts on the Internet, but still need to use IP addresses for data exchange, so the DNS system provides domain name functions at the same time. The bigger effect is to be able to efficiently map the domain name resolution to the IP address of the corresponding host. This is the role of the name server that will be introduced to you soon.

 

5. Domain name server

 

The domain name server constitutes the distributed network system in DNS, and its function is mainly to provide the domain name and IP address mutual resolution mapping service for internal and external hosts. The domain name servers are distributed in each subnet of the Internet. Each domain name server is responsible for managing and providing services to all hosts connected to this subnet. The service content is:

 

The client application sends the target host domain name to the domain name server of the subnet to which it belongs. The domain name server returns the corresponding target host IP address to the client; if the domain name server in this subnet cannot query the IP address of the target host domain name, then DNS's standard IP address resolution process provides further query services, which will be described in detail in the "Domain Name Resolution Process" below.

 

Fourth, the domain name resolution process

The process of obtaining the corresponding IP address through the domain name is called domain name resolution. The most important unit involved in the domain name resolution process is the domain name server. The architecture of the domain name server is as follows:

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

Structure of the domain name server

  • The root domain name server is the highest and most important domain name server in the world. There are a total of 13 (IPv4 root domain name servers, numbered from A to M) in the world, 1 primary root server and 9 secondary root servers in the United States, 2 secondary servers in Europe The root server is located in the United Kingdom and Sweden, and one auxiliary root server in Asia is located in Japan. The root domain name server only records the domain name and its IP address of the subordinate top-level domain name server. When the low-level domain name server encounters a domain name that cannot be resolved, it will first seek help from the root domain name server.
  • The top-level domain name server, with the same level as the top-level domain, is used to record all second-level domain names registered on the top-level domain name server and provide DNS query services.
  • The authority domain name server provides DNS query service for a host in an area. If the query result is empty, it informs the requesting DNS user which authority domain name server should go to for further inquiry.
  •  

☆ Local domain name server is not in the domain name server system in the above picture, but it plays an important role in domain name resolution. The DNS domain name query request issued by each host is first sent to the local domain name server. The local domain name server can be set up in various ranges such as individuals, universities, companies, etc. It is also called the preferred DNS (very familiar), which is the preferred DNS in our computer network connection:

 

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

Local DNS server

A picture to understand the whole process of domain name resolution:

URL, URL, domain name, IP address, DNS, domain name resolution, only for you to successfully access

 

Detailed process of domain name resolution

The above picture uses the user to visit the headline website as an example. It briefly describes the entire process from the user inputting the URL to obtaining the IP address. Let us explain the process in detail:

  • The user turns on the computer and enters the headline URL in the browser. The computer will initiate a domain name resolution request to the local DNS server. Local DNS servers are usually provided by Internet service providers (ISPs), such as the three major operators.
  • After the local DNS server receives the used DNS request, it first queries whether the IP address corresponding to the headline domain name exists in its own cache record. Ask for help.
  • Since the root domain name server will only record the 13 top-level domain name servers below it, and will not directly record the mapping relationship between the domain name and the IP, when receiving the resolution request from the local name server, the root domain name server will inform the local server: "You The requested domain name is managed by the .com top-level domain name server and its IP is xxx ".
  • The local DNS server further initiates a domain name resolution request to the .com top-level domain name server. Since the .com domain name server does not record the mapping relationship between the domain name and the IP, it informs the requester to query the domain server to which the domain name belongs and gives it IP address.
  • The local DNS server continues to initiate the headline domain name resolution request to the domain server, and it will obtain the IP address corresponding to the headline domain name. At this time, the local DNS server will not only return the IP address to the user's computer, but also add the headline domain name and its IP record in its own cache. In order to speed up the resolution speed of other computers to obtain the IP corresponding to the headline domain name.
  •  

to sum up

Learn more articles, pay attention to the public number Java Architect Alliance, and start the public number for technical learning

Published 78 original articles · Like1 · Visitors1256

Guess you like

Origin blog.csdn.net/weixin_42864905/article/details/105489874