Linux DNS 笔记
 
 
 
 
 
 
 
 
 
 
 
贡献者: addis
- 基本原理参考《30 张图解网络》系列教程
- domain name system (DNS)
-
nslookup 域名
可以查看用于解析域名的服务器,在 ubuntu22.04 上会返回 127.0.0.53
。这实际上是本机的 systemd-resolved
- 操作系统会使用
/etc/resolv.conf
文件中可以配置 linux 的 dns 服务器,但如果用了 systemd-resolved
,该文件实际上是一个软链,自动生成,不建议修改。
- 如果使用 WSL 那么
/etc/resolv.conf
是由 windows 自动生成的,见开头的注释。
- 如果没用
resolved
的话,可以在该文件里面添加若干行类似 nameserver 8.8.8.8
的设置,其中 8.8.8.8
是 google 提供的 DNS 服务。
-
dig +trace +nodnssec 域名
可以看到每一个域名服务器的 ip 和详细信息。*.root-servers.net
是跟域名服务器,tld
是顶级域名(top level domain)服务器。顶级域名就是 .com
,.net
这些
-
resolvectl query 域名
可以获取域名以及解析的信息
1. DNS record 的类型
- A records map domain names to IPv4 addresses.
- AAAA record is the IPv6 equivalent of an A record
- CNAME Redirects a domain to a different domain
- MX Provides the domain names of mail servers that receive emails on behalf of a domain
- SOA Provides important details about a DNS zone; required for every DNS zone
- TXT Provides any type of descriptive information in text format
2. 关于 Zone 和 SOA
- Zone:DNS zones need an SOA。a 'zone' is an area of control over namespace. A zone can include a single domain name, one domain and many subdomains, or many domain names. In some cases, 'zone' is essentially equivalent with 'domain,' but this is not always true.
- start of authority (SOA) record:stores important information about a domain or zone
- A zone file is a plain text file stored in a DNS server that contains an actual representation of the zone and contains all the records for every domain within the zone.
- A zone serial number is a version number for the SOA record
- A DNS zone transfer is the process of sending DNS record data from a primary nameserver to a secondary nameserver.
 
 
 
 
 
 
 
 
 
 
 
© 小时科技 保留一切权利