什么是DNS? - 完整指南
什么是DNS? - 完整指南
域名系统(DNS)是互联网的基础设施之一,相当于一本数字"电话簿"。它的主要功能是将我们容易记住的域名(如google.com)转换为计算机通信所需的数字IP地址。
完整技术定义
DNS是一个分层的分布式命名系统,用于连接到IP网络(如互联网或专用网络)的设备。
DNS服务器使用分布式层级数据库,存储与互联网等网络中域名相关联的信息。
DNS如何工作
当您在浏览器中输入网址时,会经历一个涉及多个层级的复杂DNS解析过程:
Local Query (DNS Cache)
Your device checks its local DNS cache to see if it already knows the domain's IP.
Recursive DNS Server
If not in cache, the query is sent to the configured recursive DNS server.
Root Servers
The recursive server queries the 13 global Root Server clusters.
TLD Servers
Root Servers redirect to Top Level Domain servers (.com, .es, .org).
Authoritative Server
The specific domain's authoritative DNS server is queried.
Response and Cache
The response is returned and each server caches info according to TTL.
主要DNS记录类型
A 将名称映射到IPv4地址
example.com → 192.168.1.1
AAAA 将名称映射到IPv6地址
example.com → 2001:db8::1
CNAME 将一个名称作为另一个名称的别名
www.example.com → example.com
MX 指定邮件服务器
example.com → mail.example.com
TXT 任意文本信息
SPF、DKIM、验证
NS 指定权威域名服务器
example.com → ns1.provider.com
主要DNS记录类型
A 将名称映射到IPv4地址
example.com → 192.168.1.1
AAAA 将名称映射到IPv6地址
example.com → 2001:db8::1
CNAME 将一个名称作为另一个名称的别名
www.example.com → example.com
MX 指定邮件服务器
example.com → mail.example.com
TXT 任意文本信息
SPF、DKIM、验证
NS 指定权威域名服务器
example.com → ns1.provider.com
SOA DNS区域的权威起点
区域的管理信息
PTR 将IP地址反向解析为名称
1.1.168.192.in-addr.arpa → host.example.com
SRV 服务寻址
_sip._tcp.example.com → sip.example.com:5060
CAA 证书颁发机构授权
example.com → letsencrypt.org