时间:2023-02-10 12:18:01 | 来源:建站知识
时间:2023-02-10 12:18:01 来源:建站知识
很多朋友可能会发现,在添加 CNAME、MX、NS 等记录的时候,记录值后面通常会自动补充一个"."(如下图),那为什么会自动添加这个"."呢?
有关 RFC 的详细信息,可访问互联网工程工作组 (IETF) 的官网查看:IETF | Internet Engineering Task Force
rttw@Kincaid:~$ dig www.r2wind.cn +trace; <<>> DiG 9.19.4-1+0~20220818.83+debian11~1.gbp3f0f1b-Debian <<>> www.r2wind.cn +trace;; global options: +cmd. 0 IN NS f.root-servers.net.. 0 IN NS e.root-servers.net.. 0 IN NS j.root-servers.net.. 0 IN NS i.root-servers.net.. 0 IN NS g.root-servers.net.. 0 IN NS b.root-servers.net.. 0 IN NS d.root-servers.net.. 0 IN NS h.root-servers.net.. 0 IN NS c.root-servers.net.. 0 IN NS k.root-servers.net.. 0 IN NS l.root-servers.net.. 0 IN NS m.root-servers.net.. 0 IN NS a.root-servers.net.;; Received 432 bytes from 192.168.192.1#53(192.168.192.1) in 859 ms# 递归返回根域名服务器的 NS 记录cn. 172800 IN NS a.dns.cn.cn. 172800 IN NS d.dns.cn.cn. 172800 IN NS e.dns.cn.cn. 172800 IN NS c.dns.cn.cn. 172800 IN NS b.dns.cn.cn. 172800 IN NS ns.cernet.net.cn. 172800 IN NS g.dns.cn.cn. 172800 IN NS f.dns.cn.cn. 86400 IN DS 57724 8 2 5D0423633EB24A499BE78AA22D1C0C9BA36218FF49FD95A4CDF1A4AD 97C67044cn. 86400 IN RRSIG DS 8 1 86400 20220920040000 20220907030000 20826 . Pir1xOUL//xWJtc9ey7zZJDmwSPnXHGGLTHpxxuOKwxchQkQvoSYGtCG L6YrRWEpFputpuFpK3DvPCbtPZQMje1Mr2H4vT7nZ47ht0Xr2brWSDlR maELk8iKsuNYwoJ3fL75yn1N0jEABxnYFfo9r4Pp0nfN0XVAIHvAiGE8 nhEFSmmmEZidrLfPT84+QKeXOc8fotDme/Byi5F3Uc3IRu8mq7BE/N/+ 4nXAVgXbWhO9/ULnlAK76bFqoz0qZmvrcrmSB08K//QVG4io+4nbpFyl dUlziRCAiT6h7L6WwK9XDBeWNhSMptvYJRVS01rC2X7OWqKvnU2fL/Bs FYzCSg==;; Received 708 bytes from 202.12.27.33#53(m.root-servers.net) in 99 ms# 根域名服务器返回 cn 域名的 NS 记录;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.cn failed: network unreachable.;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.cn failed: network unreachable.;; UDP setup with 2001:dc7::1#53(2001:dc7::1) for www.r2wind.cn failed: network unreachable.r2wind.cn. 86400 IN NS ns3.dnsv4.com.r2wind.cn. 86400 IN NS ns4.dnsv4.com.3QDAQA092EE5BELP64A74EBNB8J53D7E.cn. 21600 IN NSEC3 1 1 10 AEF123AB 3QHKTF6LTFG8AAFUUAJSR8RVAJP99SFU NS SOA RRSIG DNSKEY NSEC3PARAM3QDAQA092EE5BELP64A74EBNB8J53D7E.cn. 21600 IN RRSIG NSEC3 8 2 21600 20220929034902 20220830024902 38388 cn. nQpTOptIW40mn9r1uPSO/yIvyEcdfV/zhfXVU/nZptRs+gDk8MYnqO7c i3yXB2XYzZFXM3ofDWXIJHgHq42agy02zSkDKN3XabB0Y6F2Oy3FhFBP O5fNM97I5Nu1NEE2ZZ5XyGAfMZyNhjsOry66+56C4s/Dlu1LcE151vey ecY=8TF4MEBDESE2OSVH717D9VC1F7BFN1VI.cn. 21600 IN NSEC3 1 1 10 AEF123AB 8TKMCNJ923RR3GI4UAK4FF8RHB788CNF CNAME RRSIG8TF4MEBDESE2OSVH717D9VC1F7BFN1VI.cn. 21600 IN RRSIG NSEC3 8 2 21600 20220929034902 20220830024902 38388 cn. MgMG/eoy7e3ugs4TjsTxf5Ji9mvFsYYJpM+e4LayayDIMzs3JpkdKgEn ba3BmaaKclE6aDe8iL0uYSNiUMRgfMJb10yg066tDn+6bQH7BHl0paNY REZMB/+idFumyB3icj+JjCxrQe7j2fPp6aQUv3VBaEVLrp22XbnWZsbx scI=;; Received 608 bytes from 202.112.0.44#53(ns.cernet.net) in 29 ms# cn 域名服务器返回 r2wind.cn. 的 NS 记录www.r2wind.cn. 600 IN A 120.78.190.225r2wind.cn. 86400 IN NS ns4.dnsv4.com.r2wind.cn. 86400 IN NS ns3.dnsv4.com.;; Received 112 bytes from 1.12.0.25#53(ns3.dnsv4.com) in 39 ms# r2wind.cn 域名服务器返回 www.r2wind.cn. 的 A 记录
由上面一大串的流程中可以看到查询是从根开始进行查询的,然后根据返回的各个域名 NS 记录进行查询,直到查询到最终的 A 记录。root@Kincaid:~# nslookup me 8.8.8.8Server: 8.8.8.8Address: 8.8.8.8#53Non-authoritative answer:Name: me.r2wind.cnAddress: 106.52.72.124
这是因为我设置了主机的本地域名,所以系统会自动在后面添加上 http://r2wind.cn,但当我在查询 me 加了"."后,可以看到报错了,如下:root@Kincaid:~# nslookup me. 8.8.8.8;; communications error to 8.8.8.8#53: timed outServer: 8.8.8.8Address: 8.8.8.8#53Non-authoritative answer:*** Can't find me: No answer
报错的原因也很简单,加"."系统会认为你查询的是一个完整的域名,这种情况下系统不会在后面添加本地域名,而是直接进行递归查询,但 me 这个域是没有解析 A/AAAA 记录的,所以就会报错。root@Kincaid:~# dig ai. @8.8.8.8; <<>> DiG 9.19.4-1+0~20220818.83+debian11~1.gbp3f0f1b-Debian <<>> ai. @8.8.8.8;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15833;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 512;; QUESTION SECTION:;ai. IN A;; ANSWER SECTION:ai. 21600 IN A 209.59.119.34;; Query time: 319 msec;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP);; WHEN: Thu Sep 08 08:29:01 CST 2022;; MSG SIZE rcvd: 47
是不是有人想问域名 ai 的后缀是什么?是根 (root) 。关键词:记录