This is a quick guide to set up wsl-vpnkit in WSL using systemd.
This will install wsl-vpnkit as a service in your existing wsl distro as a standalone script.
Make sure you have systemd enabled in WSL.
Find the latest version of wsl-vpnkit here: https://github.com/sakai135/wsl-vpnkit/releases/latest
# Enter latest version number here, eg. VERSION=v0.4.1
VERSION=v0.4.1
# Enter install location of wsl-vpnkit eg DIR=/opt/wsl-vpnkit
DIR=/opt/wsl-vpnkit
sudo mkdir $DIR
# Fetch wsl-vpnkit and install to $DIR
wget https://github.com/sakai135/wsl-vpnkit/releases/download/$VERSION/wsl-vpnkit.tar.gz -O - | sudo tar -xz -C $DIR --strip-components=1 app/wsl-vpnkit app/wsl-gvproxy.exe app/wsl-vm app/wsl-vpnkit.service
# Configure wsl-vpnkit.service to run as a standalone script
sed -e "s|/full/path/to|$DIR|g" -e 's/^#E/E/' -e 's|^\(ExecStart=/mnt.*\)|#\1|' $DIR/wsl-vpnkit.service | sudo tee -a /etc/systemd/system/wsl-vpnkit.service >/dev/null
# Enable and start wsl-vpnkit service
sudo systemctl enable wsl-vpnkit
sudo systemctl start wsl-vpnkit
Thanks for sharing, very helpful!