jacob-pro/wsl2-dns-agent

[QUESTION] How can we disable an IPv6-DNS response at all?

PeterCodar opened this issue · 3 comments

In your example with 1 Ethernet-Adapater:
https://github.com/jacob-pro/wsl2-dns-agent/blob/master/docs/DNS_PRIORITY.md#dns-servers-on-the-same-interface

How would you prevent that you get an IPv6-Response at all?
If you are in a situation where it is necessary to only get an IPv4, how can we disable the IPv6-DNS at all?

Either remove the IPv6 DNS server from the network adapter - or disable the IPv6 stack on that network adapter.

To be honest this is kind of out of scope for this project - the goal of that document was just to discover how Windows works.

The ws2-dns-agent tool itself filters out any IPv6 servers regardless, so it shouldn't be an issue for users of the tool:

wsl2-dns-agent/src/dns.rs

Lines 211 to 218 in 1d83b43

// WSL2 doesn't currently support IPv6 - but might do in future?
// https://github.com/microsoft/WSL/issues/4518
// resolv.conf typically only allows up to 3 nameservers
self.servers
.iter()
.filter(|server| server.is_ipv4())
.take(3)
.for_each(|server| lines.push(format!("nameserver {}", server)));

Ups, sorry for going out of scope...