ipv6-wsl icon indicating copy to clipboard operation
ipv6-wsl copied to clipboard

WSL IPv6 packet enabler

IPv6 on Windows and WSL has been a bane of my existence for years. When working on a project that specifically required IPv6, I realized I'd have to figure out what was going on. Thus this little program was born.

Requirements

There are several requirements to use this.

Bridge mode

WSL must be running in bridge mode. For example, here is my /mnt/c/Users/lande/.wslconfig file:

[wsl2]
networkingMode=bridged #<--
vmSwitch=wsl #<--
dhcp=true #<--
ipv6=true #<--
macAddress=08:6a:c5:51:eb:bf #<--

memory=4GB
processors=2
localhostforwarding=true #<--
debugConsole=false

The "vmSwitch" is a normal bridged network interface set in hyper-v management console.

I then set up my /etc/resolv.conf by configuring systemd-resolved: sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

PCAP

I haven't installed this on a fresh computer, but it may required to have winpcap (I have wireshark) installed.

Why doesn't IPv6 work in WSL??

After much investigation and fiddly bits with wireshark, I came to realize that IPV6 packets weren't being forwarded to WSL correctly. I don't know why, but for whatever reason no one at Microsoft is smart enough or cares enough to fix what is probably a really simple bug.

Thus, this incredibly simple program was born.

What this program does

  1. Starts a ping command from WSL
  2. Listens for ipv6 packets sent to the Windows host with the "wrong" mac address.
  3. Resends them with the correct mac address to the bridge.
  4. Once the ping indicates the routes are learned (by seeing DUP! ping replies), stops rewriting packets until the connection fails again.
  5. Thats it.

Screenshot

Using the program

Once the network discovers the correct route, this program is not required. You have to "train" your network and Windows to allow ipv6 packets to work correctly and this program helps with that.

Here's the gist:

  1. Start this program.
  2. Select your wifi device for the internet.
  3. Select your bridge device -- note these can be the same device if required.
  4. Enter the mac address of WSL (08:6a:c5:51:eb:bf using the example given above).
  5. Push start.
  6. Connection will enter a degraded state until the routes are learned.
  7. Connection will finally say "yes" and then ipv6 will work natively.
  8. Check "start at startup" and then minimize the tray

As long as WSL continues to ping an ipv6 address, ipv6 connectivity will work without any further work.

Privacy concerns

This program REQUIRES an ipv6 address to ping. It is currently hardcoded to one of my servers:

2a01:4f9:6b:5601::2: RIPE

Supposedly, I could see who is using this software. However, nothing is tracked or monitored. I do not guarantee this server to be up 100% of the time and if this server is down, this software will misbehave.

If you have any ideas on how to make this better, please open an issue.

I do recommend building this from source and using an IP address you trust if this is a concern for you.

Get the program

You can either download the source and build it yourself or download the binary from releases.

Why does this work?

Initial connections take a few packets going to the wrong place before eventually going to the right place (and this program will handle that). You only need it to "train" your network to send packets to the right place. Once you've done that, IPv6 will continue running just fine until the network "forgets" the route.