The default eth0
network interface on WSL2 has an MTU of 1280, which isn't sufficient for large packets sent over the Wireguard protocol.
You can confirm the issue by running ip a
and seeing that the MTU of the eth0
interface is 1280.
To fix this, you need to set the MTU of the eth0
interface to 1500. This has to be done every time WSL starts.
Edit /etc/wsl.conf
to include:
[boot]
command = "bash /etc/init-wsl.sh"
Create an /etc/init-wsl.sh
:
#!/bin/bash
ip link set dev eth0 mtu 1500
Run wsl.exe --shutdown
to restart WSL. Start a new terminal and run ip a
to confirm that the MTU is set to 1500.
WSL conf stuff if you're on a version of WSL with systemctl support:
/etc/wsl.conf
:
[boot]
command = "bash /etc/init-wsl.sh"
systemd = true
This starts systemd
so that you don't have to start services manually.
Magic command to fix being unable to call Windows commands from WSL2:
sudo update-binfmts --disable cli
This is apparently caused by the mono-runtime
package; removing it also fixes the issue:
sudo apt remove mono-runtime