-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
order: 4 | ||
title: DNS | ||
--- | ||
|
||
## Introduction | ||
|
||
DNS (Domain Name System) is a distributed database used to store the mapping between domain names and IP addresses. It allows users to access target addresses using domain names without needing to remember the IP addresses. The process of obtaining the IP address from a domain name is called **DNS resolution**. | ||
|
||
::: tip Steps for accessing a website in a browser | ||
1. Send a domain name request to the DNS server. | ||
2. Obtain the IP address corresponding to the domain name. | ||
3. Send a request to the target website using the IP address. | ||
::: | ||
|
||
![dns](/assets/image/article/network/dns-example.png) | ||
|
||
### DNS Resolution Process | ||
|
||
1. **Check local DNS cache**: First, check the browser cache. If the DNS information for the domain name is not cached in the browser, the computer will check the system cache to see if there is any configuration in the Hosts file or cached information for the domain name. If it still doesn't exist, it will check the cache in the router. | ||
2. **ISP cache**: If there is no cache in the local DNS, it will enter the ISP's DNS cache to search. Internet service providers usually cache some DNS information. | ||
3. **Root domain server query**: If the corresponding data is not found in the above two caches, a query request will be sent to the root server. If the domain name belongs to another top-level domain server, the root server will send the IP address of the top-level server to the client. Otherwise, it will directly return the corresponding IP information. | ||
4. **Top-level domain server query**: If the top-level domain server cannot find the record, it will return the IP address of the authoritative domain server within its jurisdiction. | ||
5. **Authoritative domain (primary domain) server query**: If the authoritative domain server still cannot find the information, it will recursively query the next-level server until the result is found. | ||
6. **Save the result**: When the domain server obtains the IP address information, it will return the data to the client, which will cache the IP address information and then send a request to the IP address. | ||
|
||
### DNS Record Types | ||
|
||
| Record Type | Description | | ||
| ----------- | ---------------------------- | | ||
| A | Host IP address | | ||
| AAAA | Host IPv6 address | | ||
| ALIAS | Automatically resolved alias | | ||
| CNAME | Canonical name of an alias | | ||
| MX | Mail exchange server | | ||
| NS | Name server | | ||
| TXT | Descriptive text | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
order: 5 | ||
title: ARP | ||
--- | ||
|
||
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
order: 4 | ||
title: DNS | ||
--- | ||
|
||
## 介绍 | ||
|
||
DNS(Domain Name System,域名系统),是一个分布式数据库,用于存储域名和IP地址相互映射的关系,使用户能够通过**域名**访问目标地址而不需要记住**IP**地址。通过域名获取 IP 地址的过程称为**域名解析**。 | ||
|
||
::: tip 浏览器访问网站步骤 | ||
1. 发送域名请求到 DNS 服务器 | ||
2. 获取域名对应 IP 地址 | ||
3. 根据 IP 地址发送请求到目标网站 | ||
::: | ||
|
||
![dns](/assets/image/article/network/dns-example.png) | ||
|
||
### DNS 解析过程 | ||
|
||
1. **查看本地 DNS 缓存**:首先查看浏览器缓存,若浏览器中未缓存有该域名的 DNS 信息,则会到系统缓存中查询,计算机会检查 Hosts 文件中是否有配置以及系统中是否有该域名的缓存信息,若还是不存在则会在路由器中查询缓存。 | ||
2. **ISP 缓存**:若本地 DNS 中不存在缓存,则会进入 ISP 的 DNS 缓存中查询,运营商通常会缓存一部分 DNS 信息。 | ||
3. **根域名服务器查询**: 若在上述两种缓存中都没有查询到对应的数据,则需要向根服务器发送查询请求,若域名属于其他顶级域名服务器,则根服务器会将顶级服务器的 IP 发送给客户端,否则直接返回对应的 IP 信息。 | ||
4. **顶级域名服务器查询**: 若顶级域名服务器若查询不到记录,将会返回管辖范围内的权威域名服务器的 IP 地址。 | ||
5. **权威域名(主域名)服务器查询**: 若权威域名服务器还是没查询到信息,将会递归查询下一级服务器,直到查询到结果。 | ||
6. **保存结果**: 当域名服务器查询到 IP 地址信息后会将数据返回给客户端,客户端会缓存 IP 地址信息,然后向 IP 地址发送请求。 | ||
|
||
### DNS 记录类型 | ||
|
||
| 记录类型 | 描述 | | ||
| -------- | -------------------------------- | | ||
| A | 主机 IP 地址 | | ||
| AAAA | 主机 IPv6 地址 | | ||
| ALIAS | 自动解析的别名(Alias) | | ||
| CNAME | 别名的权威名称(Canonical name) | | ||
| MX | 邮件交换服务器(Mail eXchange) | | ||
| NS | 域名服务器(Name server) | | ||
| TXT | 描述文本 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
order: 5 | ||
title: ARP | ||
--- | ||
|
||
## |