问题原文
原帖链接 · Romeo Mihalcea · CC BY-SA 4.0
I'm learning more about DNS systems and right now I'm studying a very nice project written in Go and I noticed in the code that it queries for some DNS records towards nowhere/?name=probe-test.dns.nextdns.io
Initially I thought that this can't be right, it looks more like an invalid url rather than a domain name but I fired up a console and hit dig nowhere/?name=probe-test.dns.nextdns.io and it returned an A record.
$ dig nowhere/?name=probe-test.dns.nextdns.io
; <<>> DiG 9.11.3-1ubuntu1.11-Ubuntu <<>> nowhere/?name=probe-test.dns.nextdns.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53429
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;nowhere/?name=probe-test.dns.nextdns.io. IN A
;; ANSWER SECTION:
nowhere/?name=probe-test.dns.nextdns.io. 300 IN A 45.90.28.0
;; Query time: 26 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Thu Mar 12 18:55:41 EET 2020
;; MSG SIZE rcvd: 84
Can someone explain to me how is this a valid entry.
已采纳解答
原帖链接 · Doug Deden · CC BY-SA 4.0
It's a wildcard DNS entry. The dns.nextdns.io zone is configured to return 45.90.28.0 as a response to a query for anything in front of dns.nextdns.io. Here are some examples, looking for foo and bar. And for good measure, they might already have those two in their zone because they are commonly used for testing and demos, so let's look for something that they won't have anticipated -- NoWayThisExists.
C:\Users\me>nslookup foo.dns.nextdns.io 8.8.8.8
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: foo.dns.nextdns.io
Address: 45.90.28.0
C:\Users\me>nslookup bar.dns.nextdns.io 8.8.8.8
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: bar.dns.nextdns.io
Address: 45.90.28.0
C:\Users\me>nslookup NoWayThisExists.dns.nextdns.io 8.8.8.8
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: NoWayThisExists.dns.nextdns.io
Address: 45.90.28.0
So as long as the stuff you put at the beginning doesn't have any invalid characters that would trip up the DNS resolver, you'll get 45.90.28.0 as a response. And in your case, none of the characters in nowhere/?name=probe-test cause a problem. In fact, you can look up a name consisting of nothing but the symbols /, ?, =, and -.
C:\Users\me>nslookup ///???===---.dns.nextdns.io 8.8.8.8
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: ///???===---.dns.nextdns.io
Address: 45.90.28.0
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
