计算机网络笔记:DNS域名解析过程

基本概念

DNS是域名系统(Domain Name System)的缩写,也是TCP/IP网络中的一个协议。在Internet上域名与IP地址之间是一一对应的,域名虽然便于人们记忆,但计算机之间只能互相认识IP地址,域名和IP地址之间的转换工作称为域名解析,域名解析需要由专门的域名解析服务器来完成,DNS就是进行域名解析的服务器

域名与IP地址

insert image description here

在上网的时候,通常输入的是如:www.ncbuct.edu.cn这样的网址,其实这就是一个域名,而该域名实际对应的IP地址是60.10.193.26。但是这样的IP地址我们很难记住,所以有了域名的说法,域名会让我们更容易记住。网站域名一般是不变的,但是网站的IP地址可能会更换,用户通过域名访问网站,即使网站要更换IP地址,也不会给用户的访问造成影响。

域名的层次结构

insert image description here

域名解析过程

当DNS客户端向DNS服务器查询IP地址,或本地域名服务器(本地域名服务器有时也扮演DNS客户端的角色)向另一台DNS服务器查询IP地址时,可以有两种查询方式:递归查询和迭代查询。

递归查询

递归查询是指DNS客户端发出查询请求后,如果DNS服务器内没有所需的数据,则DNS服务器会代替客户端向其他的DNS服务器进行查询。在这种方式中,DNS服务器必须给DNS客户端做出回答。一般由DNS客户端提出的查询请求都是递归型的查询方式。

迭代查询

迭代查询用于DNS服务器与DNS服务器之间的查询方式。它的工作过程是:当第1台DNS服务器向第2台DNS服务器提出查询请求后,如果在第2台DNS服务器内没有所需要的数据,则它会提供第3台DNS服务器的IP地址给第1台DNS服务器,让第1台DNS服务器直接向第3台DNS服务器进行查询。依此类推,直到找到所需的数据为止。如果到最后一台DNS服务器中还没有找到所需的数据时,则通知第1台DNS服务器查询失败。

域名解析过程

example:域名为me.abc.com的主机打算发送邮件给域名为a.xyz.com的另一个主机,那么域名为me.abc.com的主机就必须知道域名为a.xyz.com主机的IP地址。

me.abc.com的主机--send mail to --domain name isa.xyz.com的另一个主机
insert image description here

① The host me.abc.com first makes a recursive query to the local domain name server dns.abc.com.

② The local domain name server uses iterative query to query a root domain name server.

③ The root domain name server tells the local domain name server the IP address of the top-level domain name server dns.com that should be queried next time. ④ The local domain name server queries the top-level domain name server dns.com.

④ The local domain name server queries the top-level domain name server dns.com.

⑤ The top-level domain name server dns.com tells the local domain name server the IP address of the authorized domain name server dns.xyz.com that should be queried next time. ⑥ The local domain name server queries the authoritative domain name server dns.xyz.com.

⑦ The authoritative domain name server dns.xyz.com tells the local domain name server the IP address of the host being queried.

⑧ Finally, the local domain name server tells the host me.abc.com the query result.

Guess you like

Origin blog.csdn.net/weixin_40119412/article/details/130463766