Tuesday, January 28, 2025

IPv6 inside WSL2 on Windows

 IPv6 inside WSL2 on Windows


If your Windows has IPv6, by default the WSL (Windows Subsystem for Linux) has no IPv6.

It's easy to solve this (if you use WSL2): in your Windows home directory, create a file .wslconfig to contain this:


[wsl2]

networkingMode=mirrored


You can do this from inside WSL with nano, as long as you make sure it's inside your Windows home directory (so /mnt/c/Users/<windows-user-name/)

If you use notepad from Windows, make sure the .wslconfig has no extension.

Then reboot Windows, start wsl, and "ip address show" should show your IPv6 inside WSL.


Check WSL version


To check that you have WSL2: from Windows, type "wsl.exe -l -v"


PS C:\> wsl -l -v

  NAME      STATE           VERSION

* Ubuntu    Running         2

No comments: