-
Notifications
You must be signed in to change notification settings - Fork 839
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
Mirrored networking IPv6 localhost (and localhost addresses) and hostAddressLoopback (for assigned addresses) not working from host (WSL2) #10803
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please 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. Thank you! Open similar issues:
Closed similar issues:
|
Thanks for writing this up. I'm pretty sure this is due to our lack of support for dual mode sockets. Same type of bug as #4851, though the port tracking here is different than what's in use by the localhost relay in nat mode. |
Could you please follow the steps below and attach the diagnostic logs? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues |
Diagnostic logs as requested. I followed the reproduction steps, i.e. 9 successful queries (4 mixed from WSL guest, 2 mixed from network, 3 IPv4 only from the host). I then ran the 3 failing queries (IPv6 from the host), then repeated that 2 more times (9 in total). Each had a 21s timeout then fails. |
@sgryphon thanks for following up and sorry for the delayed response. At the moment the hostAddressLoopback setting works only for IPv4, it is not supported for IPv6 |
@sgryphon regarding "localhostForwarding", this flag is ignored in mirrored mode, as mirrored mode already provides a way to communicate between Windows and Linux over loopback without the need for this flag. We'll update the documentation to mention that "localhostForwarding" is ignored in mirrored mode I am closing the issue |
hostAddressLoopback is only relevant for one of the three failing cases. I probably shouldn't have included localhostForwarding in the issue title (which has default true), as you are right, it has nothing to do with the issue, which is really about networkingMode = mirrored. The issue is that they don't work by for IPv6, i.e. "mirrored mode currently supports loopback communication only using IPv4" is precisely the issue that I want fixed. Unless you are saying this is by design and you won't fix -- which is silly -- why would you have mirrored mode only support IPv6 over the network but not from the host (which is what this issue is about)? (I could understand not having IPv6 at all, but having only half an implementation -- supporting network but not host -- is incomplete.) Please do not close this issue until you have added supported for IPv6 from the host to mirrored mode. Thanks. |
Can I understand mirrored mode as kind of like sharing the same network namespace by containers in the same pod in kubernetes? I read the doc, but still find it very confusing. |
@sgryphon thanks for your reply and feedback. I reopened the issue |
Windows Version
Microsoft Windows [Version 10.0.22631.2787]
WSL Version
2.0.9.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.133.1-microsoft-standard-WSL2
Distro Version
Ubuntu 22.04.2 LTS
Other Software
No response
Repro Steps
Steps to reproduce:
a. Check IPv4 access from WSL (works): curl -v4 http://localhost:8001
b. Check IPv6 access from WSL (works): curl -v6 http://localhost:8001
c. Check IPv4 with local IP (works, change IP addresses as per your networking): curl http://192.168.1.174:8001
d. Check IPv6 with local IP (works): curl http://[2407:8800:bc61:1340::899]:8001
a. Check IPv4 with IP (works): curl http://192.168.1.174:8001
b. Check IPv6 with IP (works): curl http://[2407:8800:bc61:1340::899]:8001
a. Check IPv4 localhost (works): curl -v4 http://localhost:8001
b. Check IPv4 local address (works): curl http://127.0.0.1:8001
c. Check IPv4 with IP (works): curl http://192.168.1.174:8001
a. Check IPv6 localhost (fails): curl -v6 http://localhost:8001
b. Check IPv6 local address (fails): curl -v6 http://[::1]:8001
c. Check IPv6 with IP (fails): curl http://[2407:8800:bc61:1340::899]:8001
Screen shot:
Expected Behavior
What should happen
IPv6 (and IPv4) connections to localhost and local IP addresses, from the Windows host, should be forwarded to WSL (as are other IPv6 connections).
Actual Behavior
Issue / what happens
(1) with hostAddressLoopback; without setting loopback to host address is not available on either v4 or v6 (by design)
This breaks applications trying to explicitly connect to IPv6, e.g. [::1], or that only resolve/try the IPv6 address for 'localhost'.
Error trying to use curl to connect is: curl: (28) Failed to connect to localhost port 8001 after 21048 ms: Couldn't connect to server
Mitigation: Systems that try both IPv6 and IPv4 resolutions of 'localhost' may still work (e.g. a browser with happy eyeballs may try both).
Notes
This also happens with hostAddressLoopback turned off (default), with none of the local IPs working (as expected), i.e. localhost still doesn't work. I turned it on to see if it fixed the issue (it didn't).
The python web server was used as a simple example/reproduction of the forwarding failing for IPv6, with the original issue occurring trying to access a service running in Podman hosted in WSL, i.e. a container, with Podman IPv6 enabled, trying to expose the port, and the IPv4 worked but IPv6 didn't. However the issue had nothing to do with Podman or containers, but can be reproduced as above with a simple HTTP server running on a WSL Ubuntu machine.
Diagnostic Logs
Failure messages (from Windows host):
(First response is an IPv4 success)
PS C:\Users\Sly> curl http://192.168.1.174:8001
<title>Directory listing for /</title>Directory listing for /
PS C:\Users\Sly> curl -v6 http://localhost:8001 * Trying [::1]:8001... * connect to ::1 port 8001 failed: Timed out * Failed to connect to localhost port 8001 after 21437 ms: Couldn't connect to server * Closing connection curl: (28) Failed to connect to localhost port 8001 after 21437 ms: Couldn't connect to server PS C:\Users\Sly> curl http://[::1]:8001 curl: (28) Failed to connect to ::1 port 8001 after 21057 ms: Couldn't connect to server PS C:\Users\Sly> curl http://[2407:8800:bc61:1340::899]:8001 curl: (28) Failed to connect to 2407:8800:bc61:1340::899 port 8001 after 22279 ms: Couldn't connect to server PS C:\Users\Sly>
Environment:
PS C:\Users\Sly> wsl --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.2787
PS C:\Users\Sly> ipconfig
Windows IP Configuration
Ethernet adapter Ethernet0:
Connection-specific DNS Suffix . : lan
IPv6 Address. . . . . . . . . . . : 2407:8800:bc61:1340::899
IPv6 Address. . . . . . . . . . . : fd7c:e25e:67e8:40::899
IPv6 Address. . . . . . . . . . . : fd7c:e25e:67e8:40:5c3:271c:adcc:4e6b
Temporary IPv6 Address. . . . . . : 2407:8800:bc61:1340:8035:3724:ed35:c20c
IPv6 Address. . . . . . . . . . . : 2407:8800:bc61:1340:e952:3110:2901:7499
Temporary IPv6 Address. . . . . . : fd7c:e25e:67e8:40:8035:3724:ed35:c20c
Link-local IPv6 Address . . . . . : fe80::4d6d:9ea:a521:d435%7
IPv4 Address. . . . . . . . . . . : 192.168.1.174
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
PS C:\Users\Sly> cat .wslconfig
[experimental]
networkingMode=mirrored
hostAddressLoopback=True
On the WSL instance:
sly@VMWIN2023:~$ uname -a
Linux VMWIN2023 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
sly@VMWIN2023:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1492 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:8b:52:b1 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.174/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 2407:8800:bc61:1340::899/128 scope global nodad noprefixroute
valid_lft forever preferred_lft forever
inet6 fd7c:e25e:67e8:40:5c3:271c:adcc:4e6b/64 scope global nodad deprecated noprefixroute
valid_lft forever preferred_lft 0sec
inet6 fd7c:e25e:67e8:40:8035:3724:ed35:c20c/128 scope global nodad noprefixroute
valid_lft forever preferred_lft forever
inet6 fd7c:e25e:67e8:40::899/128 scope global nodad noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::4d6d:9ea:a521:d435/64 scope link nodad noprefixroute
valid_lft forever preferred_lft forever
3: loopback0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:67:c2:f2 brd ff:ff:ff:ff:ff:ff
The text was updated successfully, but these errors were encountered: