-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/etc/hosts not getting generated with the contents of the windows hosts file #11719
Comments
Logs are required for review from WSL teamIf this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. How to collect WSL logsDownload and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. Click here for more info on logging View similar issuesPlease view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it! Closed similar issues:
|
/emailed-logs |
Diagnostic information
|
hello @lucastheisen . thanks for reporting this. I see you are using the 2.2.4 build, which has dnsTunneling enabled by default. When dnsTunneling is enabled, the Windows hosts file is not copied to the Linux hosts file, because Linux DNS queries are proxied to Windows and Windows DNS settings, including Windows hosts file are already applied to those queries. To confirm, you can try running dig test.local in Linux and we would expect it to return 127.127.127.127 |
@CatalinFetoiu , when i run (wsl-rocky9) ltheisen@PC ~
$ dig test.local
; <<>> DiG 9.16.23-RH <<>> test.local
;; global options: +cmd
;; Got answer:
;; WARNING: .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 55406
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1220
; COOKIE: a3aabcb13eac55f5e00b0b68667580ddf31c7bf9f3019eb8 (good)
;; QUESTION SECTION:
;test.local. IN A
;; AUTHORITY SECTION:
. 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2024062100 1800 900 604800 86400
;; Query time: 90 msec
;; SERVER: 10.20.100.53#53(10.20.100.53)
;; WHEN: Fri Jun 21 09:32:13 EDT 2024
;; MSG SIZE rcvd: 142 And just for clarity: (wsl-rocky9) ltheisen@PC ~
$ cat /mnt/c/Windows/System32/drivers/etc/hosts
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.127.127.127 test.local
The documentation says it is Also, is there some documentation on this I am struggling to understand what the expected behavior is here and how i can have my own hosts file, or similar feature, that will resolve my local aliases.... |
@CatalinFetoiu , i think i found the problem. We were also doing: [network]
generateResolvConf = false And my guess is that you need to generate a (wsl-rocky9) ltheisen@PC ~
$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 10.255.255.254
search LUCASTHEISEN.COM lucastheisen.home
(wsl-rocky9) ltheisen@PC ~
$ dig test.local
; <<>> DiG 9.16.23-RH <<>> test.local
;; global options: +cmd
;; Got answer:
;; WARNING: .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33790
;; flags: qr aa rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;test.local. IN A
;; ANSWER SECTION:
test.local. 254050 IN A 127.127.127.127
;; Query time: 0 msec
;; SERVER: 10.255.255.254#53(10.255.255.254)
;; WHEN: Fri Jun 21 10:39:31 EDT 2024
;; MSG SIZE rcvd: 65 Can you confirm that these settings are indeed intertwined? Is there a place i could submit an MR to the documentation that would indicate this relationship for future reference? Also, feel free to close this issue if my assertions here are correct... |
@lucastheisen, glad to hear the scenario works now thanks for pointing out that dns tunneling stills shows as disabled by default in the docs - will get that fixed. 2.2.4 is the first release build where we have this enabled by default I also plan to add documentation notes to mention the Windows hosts file is not copied in Linux and that generateResolvConf needs to be true when DNS tunneling is enabled thanks for your feedback! |
Windows Version
Microsoft Windows [Version 10.0.22621.3737]
WSL Version
2.2.4.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.153.1-microsoft-standard-WSL2
Distro Version
Rocky Linux 9.0 (Blue Onyx)
Other Software
No response
Repro Steps
Add an entry to windows hosts file:
ensure
generateHosts=true
remove
/etc/host
and restart:Open a new terminal and view
/etc/hosts
:Expected Behavior
My windows entries should be in the generated hosts file, for example:
Actual Behavior
just these:
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: