dns
dns copied to clipboard
Unable to query for root servers
I am unable to make requests for the root servers. This is what I do in nslookup (on Windows):
> nslookup - 8.8.8.8
Default Server: google-public-dns-a.google.com
Address: 8.8.8.8
> set type=ns
> .
Server: google-public-dns-a.google.com
Address: 8.8.8.8
Non-authoritative answer:
(root) nameserver = c.root-servers.net
(root) nameserver = g.root-servers.net
(root) nameserver = d.root-servers.net
(root) nameserver = b.root-servers.net
(root) nameserver = a.root-servers.net
(root) nameserver = f.root-servers.net
(root) nameserver = l.root-servers.net
(root) nameserver = j.root-servers.net
(root) nameserver = m.root-servers.net
(root) nameserver = e.root-servers.net
(root) nameserver = i.root-servers.net
(root) nameserver = k.root-servers.net
(root) nameserver = h.root-servers.net
However, when I do the following using this library, an incorrect request is sent (when inspected via Wireshark):
var client = new DnsClient("8.8.8.8");
var rootServers = client.Resolve(".", RecordType.NS);
Is there a way to query for the root records? Essentially, what I want to achieve is the equivalent of:
dig +trace example.com
I don't think that's a valid DNS query. Hope you figured it out.
I no longer need this because I found a workaround, but - for future reference - dig
can make these requests, so the DNS system definitely supports it. The .
is not literally sent to the DNS server, of course, but it appears that an empty request is sent. Here's a screenshot from a Wireshark capture where dig
requests the root name servers:
To reproduce, simply capture DNS traffic in Wireshark and run
dig +trace example.com
.
Now I see the issue. Maybe the domain name parsing needs to be changed. A workaround at the moment is to use an empty label array, e.g:
DnsClient client = new DnsClient("8.8.8.8");
IResponse response = await client.Resolve(new Domain(new byte[0][]), RecordType.NS); // or new string[]