Understand in one article: website, URL, domain name, IP address, DNS, domain name resolution

Understand in one article: website, URL, domain name, IP address, DNS, domain name resolution

Today, I will give you a long article about web addresses, URLs, IP addresses, domain names, DNS, and domain name resolution in plain language, and use a simple question-answer format to help readers have a deeper understanding of web addresses, URLs, IP addresses, domain names, DNS, and domain name resolution. I hope it will be helpful for readers' study, interviews, and work!

1. A 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 a unique IP address.
  • Any communication between two hosts on the Internet is achieved through IP addresses.

After understanding the above content, let's take the simplest communication method between two hosts - surfing the Internet as an example to explain what this question is!

Everyone in the 21st century should be familiar with the process of surfing the Internet (I don’t know if anyone still uses this term). The essence of surfing the Internet is to obtain the data on the host corresponding to the URL and display it on the user’s host (on the browser). Then we should doubt a question:

Any two hosts on the Internet communicate with each other through IP addresses. When we go online, we just enter the URL, not the IP address. How can we find the other host and get its data?

A question

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

2. Website

1. What is the URL?

A website address, also called a domain name or URL, is a name used by Internet users to identify a host. The name is unique and hierarchical. Its literal meaning can represent the host's account, function, nature, region or organization, making it easy for all Internet users to remember and use it!

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

URL structure and examples

Features: URL naming follows Internet domain name rules and is easy to manage, including allocation, confirmation, and recovery. It is also bound to the host IP address, and can efficiently map the URL to the IP address when the user accesses the domain name (efficiency is guaranteed by the domain name server, see below for details).

Website

2. What problem did the emergence of URLs solve?

The emergence of web addresses/domain names/URLs solves the following two problems:

  • Question 1: IP address is the unified addressing method for all hosts on the Internet. Using IP address, you can directly access host data and resources on the Internet. However, since IP address is just a string of data and has no practical meaning, it is very difficult for all Internet users to remember it.
  • Question 2: In the Internet architecture, almost all application layer software does not access host resources on the Internet through IP addresses, but requires users to enter meaningful host names to access the corresponding hosts.

IP addresses are difficult to remember

3. The structure of the URL

The host name mentioned above, that is, the naming of the URL/domain name follows certain rules, which are formulated by the "name management agency" in the Internet, namely the Domain Name System DNS. Here is an introduction to the composition of the URL:

The domain name of a host on the Internet is composed of the domain names at all levels to which it belongs and its own name (that is, it is composed of subdomains). The levels increase from left to right. The rightmost is the top-level domain name, and the leftmost is the host's own name. The subdomains at all levels are separated by ".". The common format is as follows:

  1. Host name.Organization name.Network name.Top-level domain name

The domain name of USTC

The following will introduce the domain name system DNS mentioned in the above figure in detail, including what problems DNS solved when it was born, 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 expansion!

3. DNS Domain Name System

1. What is DNS?

DNS, which stands for Domain Name System in English, means domain name system in Chinese. It is a distributed database that provides mapping between domain names and IP addresses on the Internet.

2. DNS Development History

History of DNS

3. What problem does DNS solve?

As mentioned earlier, the DNS domain name system is the host domain name management system on the Internet, acting as an "administrator"! Before the birth of DNS (in the ARPANET era), each host on the Internet used a file to record all host names and their IP addresses. This file was hosts.txt (now it is a hosts file without a suffix). All hosts must regularly update this file from the corresponding site to synchronize the addition, change, and disappearance of hosts on the Internet.

Hosts file contents

It is conceivable that as the number of hosts on the Internet increases, the hosts file will become larger and larger, the difficulty of maintenance and updating will increase dramatically, and host name conflicts will occur more frequently. In order to solve this problem, the DNS domain name system came into being in 1983.

What Problems Does DNS Solve?

4. DNS Domain Name Hierarchy

DNS is a hierarchical tree structure, each layer consists of domains. The meanings of domains are as follows:

  • A domain represents an area or 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
  • DNS standards stipulate that the length of a single domain name is generally within 63 characters and no longer than 255 characters.
  • DNS standards stipulate that the characters in a domain name are limited to 26 letters (not case-sensitive), numbers, and hyphens ("-" cannot be used as the first or last letter of a 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 DNS domain name tree consists of the root domain, top-level domain, second-level domain and its subdomains. The structure diagram and example are as follows:

Domain name structure

The following describes each level of domain one by one:

  • The root domain is managed by the Internet Network Information Center (InterNIC) and is represented by a dot ".". It has no name and is the highest-level domain in the domain name system. The standard domain name should end with the root domain ".", but in actual use, the root domain is omitted, so the common URLs do not have a "." at the end.
  • Top-Level Domains (TLD), which belongs to the root domain, is the next level domain after the root domain. It is composed of country-level top-level domains (ccTLD) and generic top-level domains (gTLD). There are 243 country-level 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 theoretically will reach infinity. The following table lists common generic top-level domains:

Generic top-level domain

  • A second-level domain is a unique name officially registered for use by organizations and individuals. For example, the words "amazon", "ibm" and "microsoft" in the official websites of Amazon, IBM and Microsoft (the headlines cannot contain URLs) are the second-level domain names registered by these companies.
  • Subdomains below the second-level domain. Organizations in the second-level domain can further divide subdomains as needed, such as the sales department uses the sale subdomain, the business department uses the business subdomain, and so on.

As mentioned in the previous article, the emergence of domain names is to solve the problem of users' difficulty in memorizing. In fact, domain names cannot be used for communication between hosts on the Internet, and IP addresses are still needed for data exchange. Therefore, the DNS system not only provides domain name functions, but also has the greater role of efficiently mapping domain name resolution to the IP address of the corresponding host. This is the role of the domain name server that will be introduced to you soon.

5. Domain Name Server

Domain name servers constitute a distributed network system in DNS. Their main function is to provide domain name and IP address resolution and mapping services for internal and external hosts. Domain name servers are distributed in various subnets of the Internet. Each domain name server is responsible for managing all hosts connected to this subnet and providing services for them. 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, and 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 of the target host domain name, it provides further query services according to the standard IP address resolution process of DNS. This process will be described in detail in the "Domain Name Resolution Process" below.

4. Domain Name Resolution Process

The process of obtaining the corresponding IP address through a 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:

The structure of a domain name server

  • The root domain name server is the highest level and most important domain name server in the world. There are 13 of them in the world (IPv4 root domain name servers, numbered from A to M), 1 main root server and 9 auxiliary root servers in the United States, 2 auxiliary root servers in Europe, located in the United Kingdom and Sweden, and 1 auxiliary root server in Asia, located in Japan. The root domain name server only records the domain name and IP address of its subordinate top-level domain name server. When a lower-level domain name server encounters a domain name that cannot be resolved, it will first ask the root domain name server for help.
  • The top-level domain name server is at the same level as the top-level domain. It is used to record all second-level domain names registered on the top-level domain name server and provide DNS query services.
  • The authoritative domain name server provides DNS query services for hosts in a region. If the query result is empty, the DNS user who initiated the request is notified of which authoritative domain name server to query further.

☆Local domain name server is not in the domain name server system in the figure above, but it plays an important role in domain name resolution. The DNS domain name query request sent by each host will first be sent to the local domain name server. The local domain name server can be set up in various scopes 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:

Local DNS Server

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

Domain name resolution detailed process

The above figure takes the user visiting the Toutiao website as an example, and briefly describes the whole process from the user entering the URL to obtaining the IP address. Let's explain the process in detail below:

  • When a user turns on a computer and enters the URL of a headline in a browser, the computer will initiate a domain name resolution request to a local DNS server. The local DNS server is usually provided by an Internet service provider (ISP), such as the three major operators.
  • After receiving the DNS request from the user, the local DNS server first checks its own cache record to see whether the IP address corresponding to the Toutiao domain name exists. If so, it directly sends the IP address back to the user's computer; otherwise, it will further initiate help from the root domain name server.
  • Since the root domain name server only records the 13 top-level domain name servers under it, and does not directly record the mapping relationship between the domain name and the IP, when receiving a resolution request from the local domain name server, the root domain name server will inform the local server: "The domain name you requested 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 tells the requester to query the domain server to which the domain name belongs and gives its IP address.
  • The local DNS server continues to initiate a Toutiao domain name resolution request to the domain server, and will obtain the IP address corresponding to the Toutiao domain name. At this time, the local DNS server will not only return the IP address to the user's computer, but also add a record of the Toutiao domain name and its IP in its own cache, thereby speeding up the resolution speed of other computers obtaining the IP corresponding to the Toutiao domain name.

Summarize

This article uses easy-to-understand language and combines practical problems to elaborate on the technical principles of web addresses, domain names, IP addresses, URLs, domain name servers, domain name resolution, etc., and configures detailed schematic diagrams to make the content easier for readers to understand and remember. I hope it will be helpful for readers' study and work!

<<:  STP Spanning Tree Protocol Working Principle

>>:  In-depth understanding of the working principle of VLAN with pictures and texts, don't miss it

Recommend

Will 2019 be the first year of 5G? The three major operators: Not happening!

In 2019, people inside and outside the industry s...

...

LOCVPS brings you cool autumn, 60% off on monthly VPS in Singapore

LOCVPS offers special events for different packag...

What is 6G and when can we expect it?

Since 5G networks are still being deployed around...

Explain RPC and HTTP in plain language

With the continuous development of enterprise IT ...

How to identify fiber link problems?

Methods for Identifying Fiber Link Problems There...

Five trends in edge computing for 2022

Edge computing trends play a key role in business...

Want to be a data scientist? See if you have these 5 qualities

【51CTO.com Quick Translation】 Data science career...

Can 5G enable remote surgery?

In the early days of 5G, we often saw various hig...

How 5G frequencies affect range and speed

Experts say that while 5G technology is a huge im...