Home Posts Enable IPv6 Support in WSL-2

How to Enable IPv6 Support in WSL-2 Distributions

Post Featured Image
Calendar Icon (date post was published) published on  24 Feb 2022

Problem

With WSL version 2 IPv6 connectivity is not working anymore (like it did with WSLv1). There is an open issue on GitHub about that for quite a long time, but as of now the support has not been added officially.
However, a user on GitHub discovered a new feature in the preview version of WSL, that is not yet documented and allows for setting up a bridged network for WSL2 distributions.

If you are using Windows 11 Pro, you may follow the steps below to enable IPv6 support until Microsoft is officially supporting it.

Solution/ Workaround

First, install the WSL Preview from the Windows Store.

Second, create an external virtual switch as explained in the official WSL docs.

Third, add the following lines to the .wslconfig file (create the file, if it doesn't exist):

[wsl2]
networkingMode=bridged
vmSwitch=wsl-bridge
ipv6=true

Make sure to exchange wsl-bridge with the name of the bridge you created previously.

The .wslconfig file is located in the user directory, e.g. C:\Users\username\.wslconfig.

Finally, restart wsl: wsl --shutdown.
You will now be able to access/ use IPv6 networks:

curl -6 google.de
# should not fail
Categories: