我今天发现了一件有趣的事:所有域名都*.localhost.yarf.nl
解析为127.0.0.1
。
- 这是什么?
- 这是在哪里记录的?
- 我找不到对它的引用...
这里有一些例子:
» dig aaa.localhost.yarf.nl
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> aaa.localhost.yarf.nl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18392
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;aaa.localhost.yarf.nl. IN A
;; ANSWER SECTION:
aaa.localhost.yarf.nl. 3244 IN A 127.0.0.1
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Mar 21 07:26:40 CET 2019
;; MSG SIZE rcvd: 66
和:
» dig whatisthis.localhost.yarf.nl
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> whatisthis.localhost.yarf.nl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27196
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;whatisthis.localhost.yarf.nl. IN A
;; ANSWER SECTION:
whatisthis.localhost.yarf.nl. 3600 IN A 127.0.0.1
;; Query time: 55 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Mar 21 07:26:52 CET 2019
;; MSG SIZE rcvd: 73
但:
» dig whatisthis.yarf.nl
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> whatisthis.yarf.nl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 24959
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;whatisthis.yarf.nl. IN A
;; AUTHORITY SECTION:
yarf.nl. 300 IN SOA ns091.auroradns.eu. admin.auroradns.eu. 2019011601 86400 7200 604800 300
;; Query time: 38 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Mar 21 07:26:59 CET 2019
;; MSG SIZE rcvd: 107
和:
» dig yarf.nl
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> yarf.nl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13207
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;yarf.nl. IN A
;; ANSWER SECTION:
yarf.nl. 3600 IN A 5.157.81.33
;; Query time: 33 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Mar 21 07:27:06 CET 2019
;; MSG SIZE rcvd: 52
答案1
为什么它解析为127.0.0.1?
这是一个域名,其所有者添加了一个A
(地址)记录127.0.0.1
作为值/目的地。它实际上就是这么简单。
NAME TTL TYPE VALUE
-------------------- --- ---- ---------
*.localhost.yarf.nl. 1h A 127.0.0.1
为什么它适用于任何子域名?
它是通配符记录。如果您添加名为的子域名*
,这将被视为“通配符”,并且服务器将对任何名称响应相同的数据(除非被更具体的条目覆盖)。