This corrects issues you might have with various VPN Clients having discrepancies with MTU size between WSL and the Windows Host.
Create a file /usr/local/sbin/mtu
and add the following:
#!/bin/bash
ip link set dev eth0 mtu 1400
Then update the permissions by running sudo chmod u+x,go-rwx /usr/local/sbin/mtu
Next create /etc/sudoers.d/mtu
using the command sudo visudo -f /etc/sudoers.d/mtu
. Now add the following to the file, replacing <YOUR_USERNAME_HERE>
with the output of whoami
:
<YOUR_USERNAME_HERE> ALL=(root) NOPASSWD: /usr/local/sbin/mtu
Finally, in your .zshrc
or .bashrc
add the line:
sudo mtu
To apply your changes, exit and run wsl --shutdown
from Powershell.
This is a lifesaver. Thank you!