### Install and Run wsl-vpnkit as Standalone Script Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This comprehensive shell script installs necessary dependencies (iproute2, iptables, etc.), downloads the `wsl-vpnkit` release, unpacks its components, and then runs the `wsl-vpnkit` script in the foreground. It provides an example for setting up `wsl-vpnkit` to operate as a normal script within an existing WSL distro like Ubuntu. ```sh sudo apt-get install iproute2 iptables iputils-ping dnsutils wget VERSION=v0.4.x wget https://github.com/sakai135/wsl-vpnkit/releases/download/$VERSION/wsl-vpnkit.tar.gz tar --strip-components=1 -xf wsl-vpnkit.tar.gz \ app/wsl-vpnkit \ app/wsl-gvproxy.exe \ app/wsl-vm \ app/wsl-vpnkit.service rm wsl-vpnkit.tar.gz sudo VMEXEC_PATH=$(pwd)/wsl-vm GVPROXY_PATH=$(pwd)/wsl-gvproxy.exe ./wsl-vpnkit ``` -------------------------------- ### Configure and Enable wsl-vpnkit Systemd Service Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This set of shell commands configures `wsl-vpnkit` to run as a systemd service, ensuring it starts automatically with your WSL distro (for WSL versions 0.67.6+). It includes steps for copying the service file, enabling and starting the service, and checking its operational status. ```sh wsl.exe -d wsl-vpnkit --cd /app cat /app/wsl-vpnkit.service | sudo tee /etc/systemd/system/wsl-vpnkit.service sudo cp ./wsl-vpnkit.service /etc/systemd/system/ sudo nano /etc/systemd/system/wsl-vpnkit.service sudo systemctl enable wsl-vpnkit sudo systemctl start wsl-vpnkit systemctl status wsl-vpnkit ``` -------------------------------- ### Install wsl-vpnkit as a WSL Distro Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This PowerShell command imports the `wsl-vpnkit.tar.gz` file, downloaded from the latest release, as a new WSL 2 distribution named `wsl-vpnkit`. It sets up the necessary environment for `wsl-vpnkit` to run within its own dedicated WSL instance. ```pwsh wsl --import wsl-vpnkit --version 2 $env:USERPROFILE\wsl-vpnkit wsl-vpnkit.tar.gz ``` -------------------------------- ### Uninstall wsl-vpnkit WSL Distro Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This PowerShell command unregisters the `wsl-vpnkit` WSL 2 distribution, effectively removing it and all its associated files from your system. This is the standard and recommended procedure for uninstalling the distro-based setup of `wsl-vpnkit`. ```pwsh wsl --unregister wsl-vpnkit ``` -------------------------------- ### Update wsl-vpnkit WSL Distro Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md To update `wsl-vpnkit` when installed as a distro, this PowerShell sequence first unregisters the existing `wsl-vpnkit` distribution. It then re-imports the new version from `wsl-vpnkit.tar.gz`, ensuring the latest features and fixes are applied to the dedicated WSL instance. ```pwsh wsl --unregister wsl-vpnkit wsl --import wsl-vpnkit --version 2 $env:USERPROFILE\wsl-vpnkit wsl-vpnkit.tar.gz ``` -------------------------------- ### Build and Run wsl-vpnkit from Source Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md These shell commands demonstrate the process of building the `wsl-vpnkit` distro from source, allowing for custom configurations or development. It shows how to build with different base images (Alpine, Fedora with Podman), import the newly created distro, and then run it. ```sh ./build.sh alpine DOCKER=podman ./build.sh fedora ./import.sh wsl.exe -d wsl-vpnkit --cd /app wsl-vpnkit ``` -------------------------------- ### Enable WSL Interop and Set GVPROXY_PATH for wsl-gvproxy.exe Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This snippet provides commands to enable automount in the wsl-vpnkit distro's wsl.conf and set the GVPROXY_PATH environment variable. This resolves issues where wsl-gvproxy.exe is not executable due to WSL interop settings or Windows permissions, allowing it to be run from a permitted location. ```sh # enable [automount] in wsl.conf for wsl-vpnkit distro wsl.exe -d wsl-vpnkit --cd /app sed -i -- "s/enabled=false/enabled=true/" /etc/wsl.conf # set GVPROXY_PATH when running wsl-vpnkit wsl.exe -d wsl-vpnkit --cd /app GVPROXY_PATH=/mnt/c/path/wsl-gvproxy.exe wsl-vpnkit ``` -------------------------------- ### Run wsl-vpnkit Distro in Foreground Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This shell command executes the `wsl-vpnkit` script within the imported `wsl-vpnkit` WSL 2 distribution. It runs the application in the foreground from the `/app` directory, allowing direct observation of its output and operation. ```sh wsl.exe -d wsl-vpnkit --cd /app wsl-vpnkit ``` -------------------------------- ### Run wsl-vpnkit Service with Debug Mode Enabled Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This command demonstrates how to run the wsl-vpnkit service with the DEBUG environment variable set to '1'. Enabling debug mode provides more verbose output, which is useful for diagnosing issues and understanding the service's behavior. ```sh # set the DEBUG environment variable wsl.exe -d wsl-vpnkit --cd /app DEBUG=1 wsl-vpnkit ``` -------------------------------- ### Shutdown WSL 2 VM and Kill wsl-gvproxy Processes Source: https://github.com/sakai135/wsl-vpnkit/blob/main/README.md This PowerShell snippet provides commands to shut down the entire WSL 2 virtual machine, which can help reset networking states. Additionally, it includes a command to terminate any lingering wsl-gvproxy processes that might be running, ensuring a clean restart. ```pwsh # PowerShell # shutdown WSL to reset networking state wsl --shutdown # kill any straggler wsl-gvproxy processes kill -Name wsl-gvproxy ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.