Open andyli opened 5 years ago
@paulstelian97
I wouldn't expect it to resolve to an IPv6 address if IPv4 is available.
The default in a lot of distributions is to prefer public IP addresses over private. 99% of the time IPv6 is provisioned using public IPs, while 99% of the time IPv4 is provisioned using private. Furthermore, it is also common to prefer IPv6 over IPv4 wholesale when both are public.
In summary: you shouldn't be surprised to see Linux prefer IPv6. :-)
Source: man gai.conf(5) and RFC 3484
As a bonus, WSL2 always has private IP address for IPv4... It does NOT have the host IP address. It's a NAT with extra tricks.
The surprise is why prefer IPv6 if it's NOT CONFIGURED? No public IPv6 (router advertisement, DHCP etc) reaches the WSL2 distro.
@paulstelian97
Ah, gotcha. Good to clear that out. Yes, unless Linux believes it can route IPv6 it shouldn't use it -- unless the user is on an IPv6 only network using NAT64 maybe? Then the DNS resolution would always return AAAA and no A I think
EDIT: To be clear, what I am suggesting above would definitely 100% require WSL 2 to support and provision IPv6, I am merely suggesting a possible configuration that would lead to IPv6 resolutions being the only thing being tried (unsuccessfully) in a IPv4-only environment - where normally a IPv4 try would be done.
@paulstelian97
Ah, gotcha. Good to clear that out. Yes, unless Linux believes it can route IPv6 it shouldn't use it -- unless the user is on an IPv6 only network using NAT64 maybe? Then the DNS resolution would always return AAAA and no A I think
Issue still remains. WSL2 only has IPv4 in the 172.x.y.z (forgot what x was exactly) and no IPv6 at all (unless I do weird tricks on the host). Any NAT64 and shit available on the host Windows system never reaches the WSL2 distro.
I don't think Windows will even proxy the IPv4 requests through the NAT64...
If by a chance you have VMWare Workstation installed, it's possible to bridge Hyper-V switch to VMware VMnet, which is capable enough to perform IPv6 NAT, using host's IPv6 address and routing. Hyper-V VM/WSL2 --> Hyper-V bridge switch to "external" VMnet NAT interface --IPv6 NAT--> Host's IPv6 network p.s as a bonus - IPv4 NAT with stable address space
If by a chance you have VMWare Workstation installed, it's possible to bridge Hyper-V switch to VMware VMnet, which is capable enough to perform IPv6 NAT, using host's IPv6 address and routing. Hyper-V VM/WSL2 --> Hyper-V bridge switch to "external" VMnet NAT interface --IPv6 NAT--> Host's IPv6 network p.s as a bonus - IPv4 NAT with stable address space
What if I want a public IPv6 address? I'm only using IPv6 specifically due to lack of requirement for NAT. Is there a variant to run a NDP proxy on Windows 10?
If by a chance you have VMWare Workstation installed, it's possible to bridge Hyper-V switch to VMware VMnet, which is capable enough to perform IPv6 NAT, using host's IPv6 address and routing. Hyper-V VM/WSL2 --> Hyper-V bridge switch to "external" VMnet NAT interface --IPv6 NAT--> Host's IPv6 network p.s as a bonus - IPv4 NAT with stable address space
What if I want a public IPv6 address? I'm only using IPv6 specifically due to lack of requirement for NAT. Is there a variant to run a NDP proxy on Windows 10?
well, outgoing connections will have public address of the host. as for incoming connections, seems not possible - VMWare allows only IPv4 port forwarding
I thought Hyper-v itself had IPv6 support. Shouldn't enabling it and doing something for WSL2 to recognize the network adapter in hyper-v for ipv6 support work?
I thought Hyper-v itself had IPv6 support. Shouldn't enabling it and doing something for WSL2 to recognize the network adapter in hyper-v for ipv6 support work?
I'm not aware of any Hyper-V support except for manual configuration or bridged. The WSL adapter isn't bridged. I had managed to do manual configuration before. I wonder how I could make IPv6 static routes on my router...
Since there's a powershell module you can use for managing Hyper-V, I wonder if it could be used for WSL2 in some way for allowing a bridge. Official bridge support is still pending though.
@craigloewen-msft any chance we can lock this issue until there's an update on the MS side? I'd like the say subscribed to the issue so I know when I can try wsl2 again, however it's getting rather noisy here and I'm on the verge of unsubscribing. Thanks :-)
Since there's a powershell module you can use for managing Hyper-V, I wonder if it could be used for WSL2 in some way for allowing a bridge. Official bridge support is still pending though.
@WSLUser I have tried manually setting a bridge and, while that works immediately, after reboot everything messes up and a NEW adapter for WSL2 is created. It's not a persistent configuration. WSL itself messes you up.
Since there's a powershell module you can use for managing Hyper-V, I wonder if it could be used for WSL2 in some way for allowing a bridge. Official bridge support is still pending though.
@WSLUser I have tried manually setting a bridge and, while that works immediately, after reboot everything messes up and a NEW adapter for WSL2 is created. It's not a persistent configuration. WSL itself messes you up.
yes, each time WSL2 is started (means - not only on reboot), WSL adapter is recreated and manual bridging to anyting (incl. VMnet) is being lost.
Also, (at least to me) not only briding is lost, but old bridged interface remains in a "half bridged" state and I have to manually disable bridging before functionality is recovered (thus, after each reboot I'm offline until I do it), which is even worse. Still, I prefer to do that that using WSL2 in the default IPv4-only NAT mode.
I actually had TunnelBroker for IPv6 initially and had reserved a /64 for WSL2, plus adding manual routing on my Pi (which did the TunnelBroker connection) so that packets destined for that /64 actually go to my laptop. That worked BEAUTIFULLY with no need for extra configuration. I however don't know how to do an equivalent setup with my router (does Windows have anything to request prefix delegation?)
(does Windows have anything to request prefix delegation?)
Not that I am aware of. But you could manually route a prefix to your Windows PC.
(does Windows have anything to request prefix delegation?)
Not that I am aware of. But you could manually route a prefix to your Windows PC.
Are you aware on how to do it on my TP-Link Archer C6? (now I have native IPv6 from my ISP...) I can't seem to find static routing options for IPv6, only for IPv4...
@paulstelian97 maybe not with the stock firmware. OpenWrt can do.
I have tried manually setting a bridge and, while that works immediately, after reboot everything messes up and a NEW adapter for WSL2 is created. It's not a persistent configuration. WSL itself messes you up.
@paulstelian97 can you provide steps here? Probably should add the removal of the old bridge as part of the process based on comments above. Should be easy to add it to Task Manager so it happens upon login.
I have tried manually setting a bridge and, while that works immediately, after reboot everything messes up and a NEW adapter for WSL2 is created. It's not a persistent configuration. WSL itself messes you up.
@paulstelian97 can you provide steps here? Probably should add the removal of the old bridge as part of the process based on comments above. Should be easy to add it to Task Manager so it happens upon login.
Not sure, I just did it manually from the GUI (select the "vEthernet (WSL)" interface and my Wi-Fi interface, right click, create bridge). Sure that sometimes f's up badly with Wi-Fi... So my setup was actually a different one which relied on how TunnelBroker's tunnels worked (had a tunnel on my Raspberry Pi, did some static routing and fixed IP addresses both on my laptop and my Pi).
Locking this issue until we have updates on IPV6 support. Thanks all for your patience!
Also working on getting a method for the surrounding discussions to still take place. Stay tuned! :)
I've created a page for this on a new feature called "Discussions" for users who wish to keep discussing this feature request and any workarounds.
https://github.com/microsoft/WSL/discussions/5855
Learn more about this discussions feature here: https://github.com/microsoft/WSL/discussions/5854
We will post any updates to this thread on this feature as they are available.
Thanks all!
Hi folks, we have put out a new update that aims to address networking issues in WSL. In your .wslconfig
file you can set experimental.networkingMode=mirrored
, as well as some other key settings that should improve your network compatibility, and add support for IPv6! Please try them out and let us know what you think.
More info on this release and the changes can be found here in the blog post.
Please note: You need to be on a Windows Insiders version to use the new networking settings (Any channel of Windows Insiders will do, including release preview). If you see the "These are not supported" messages it means that your current Windows version doesn't have support, and you will need to upgrade. These features will eventually be coming to Windows 11 22H2.
Will the fix also reach win10?
@craigloewen-msft Good news! Could you elaborate on how this mirrored mode works? Does it create an external virtual switch just like you can in regular Hyper-V? This works great for Ethernet, but I never got it to work on WiFi, probably due to lack of an ND proxy. I would be willing to switch to an Insiders version to get IPv6 in WSL, but only if WiFi is supported.
These new networking features are now available on the latest version of Win11 22H2!
@NiKiZe currently this is not planned to go back to Win10.
Please make sure you're on the latest build to get these features, you can do that by clicking "Check for Updates" in Windows settings. You can check you have the right build by either ensuring you have KB5031354 installed, or run cmd.exe /c ver
and ensure that your build number is 22621.2428 or higher (Including the minor build number which is after the .
as this was a backport!)
Thanks @craigloewen-msft, tried it and it works great for me on WiFi! Windows 11 22H2 10.0.22621.2428, WSL 2.0.6. I now understand that mirrored mode is indeed not a bridge, but shares the IPv6 addresses of the host system. No NAT and no ND proxy required. 👍
Will this eventually make its way into Windows Subsystem for Android?
These new networking features are now available on the latest version of Win11 22H2!
@NiKiZe currently this is not planned to go back to Win10.
Please make sure you're on the latest build to get these features, you can do that by clicking "Check for Updates" in Windows settings. You can check you have the right build by either ensuring you have KB5031354 installed, or run
cmd.exe /c ver
and ensure that your build number is 22621.2428 or higher (Including the minor build number which is after the.
as this was a backport!)
Hi, does "latest version of Win11 22H2" mean latest stable, which is 22H2 or latest insider version, which belongs to 22H2 branch?
@TurnOffNOD Latest stable, you don't need an Insiders version anymore.
For those playing at home, you may need to run: wsl --update --pre-release
For me it did not work initially even though I had the latest version.
Then I tried wsl --update --pre-release
which completely broke WSL2 for me (distro was just crashing after startup).
After that I ran just wsl --update
and magically everything was fixed and IPv6 started working!
For everyone having issues, in the meantime it's without the experimental prefix
[wsl2]
networkingMode=mirrored
This one worked for me: https://www.marvinweber.net/posts/wsl2-ipv6-support/
It's in bridge mode though.
But I already run a VM in Hyper V in bridge mode, so as long as it doesn't break other stuff I will continue with this.
These new networking features are now available on the latest version of Win11 22H2!
@NiKiZe currently this is not planned to go back to Win10.
Please make sure you're on the latest build to get these features, you can do that by clicking "Check for Updates" in Windows settings. You can check you have the right build by either ensuring you have KB5031354 installed, or run
cmd.exe /c ver
and ensure that your build number is 22621.2428 or higher (Including the minor build number which is after the.
as this was a backport!)
I am actually on Version 10.0.22631.3296
and still cannot reach ipv6 websites...
ping 6 google.com
ping: google.com: Temporary failure in name resolution
Setting .wslconfig
with
[wsl2]
# Changes how DNS requests are proxied from WSL to Windows
dnsTunneling=true
networkingMode=mirrored
doesn't help either.
Mine now works on windows 11
sean@ANTEC:~$ uname -a
Linux ANTEC 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
sean@ANTEC:~$ ping -6 google.com
PING google.com(syd15s17-in-x0e.1e100.net (2404:6800:4006:812::200e)) 56 data bytes
64 bytes from syd15s17-in-x0e.1e100.net (2404:6800:4006:812::200e): icmp_seq=1 ttl=119 time=2.94 ms
64 bytes from syd15s17-in-x0e.1e100.net (2404:6800:4006:812::200e): icmp_seq=2 ttl=119 time=3.03 ms
64 bytes from syd15s17-in-x0e.1e100.net (2404:6800:4006:812::200e): icmp_seq=3 ttl=119 time=2.63 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 2.633/2.865/3.025/0.167 ms
sean@ANTEC:~$
[wsl2] networkingMode=mirrored
Worked for me too.
>ver
Microsoft Windows [version 10.0.22631.3447]
[wsl2] networkingMode=mirrored
Have done that on 2 systems. One worked, one not. Both running WSL 2.2.4.0. I tried also the [experimental]
config.
I can ping the own WSL IPv6 but not a IPv6 outside of WSL... Network is unreachable
.
I can connect to any IPv6 from Windows, but not the WSL IPv6.
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 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:cd:1b:fb brd ff:ff:ff:ff:ff:ff
inet 172.23.124.191/20 brd 172.23.127.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fecd:1bfb/64 scope link
valid_lft forever preferred_lft forever
Writing to confirm that I have had success creating a .wslconfig
file and having the following entry:
[experimental]
networkingMode=mirrored
Your Windows build number: 10.0.18980.1
What you're doing and what's happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.)
I tried to access a ipv6 only website and failed. My commands run in Debian Buster with WSL 2:
The curl command should succeed. Here is the result if I run it in Windows (outside of WSL):
FYI, here is my network interface info: