You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* install as distro
* add config option for forwarding
* small edits to readme
* move distro files to dir
* use same dir to install distro as readme
* build npiperelay.exe
* verify Docker Desktop Installer file
* add build ref to distro image
* update readme
* show installed package versions
* update build
* Create LICENSE
Uses [VPNKit](https://github.com/moby/vpnkit) and [npiperelay](https://github.com/jstarks/npiperelay) to provide network connectivity to the WSL 2 VM. This requires no settings changes or admin privileges on the Windows host.
3
+
The `wsl-vpnkit` script uses [VPNKit](https://github.com/moby/vpnkit) and [npiperelay](https://github.com/jstarks/npiperelay) to provide network connectivity to the WSL 2 VM while connected to VPNs on the Windows host. This requires no settings changes or admin privileges on the Windows host.
4
4
5
-
## Setup
6
-
7
-
The following steps will use WSL to setup `wsl-vpnkit`. If you do not have connectivity in WSL 2, you can [switch your WSL version](https://docs.microsoft.com/en-us/windows/wsl/install-win10#set-your-distribution-version-to-wsl-1-or-wsl-2) to WSL 1 for setup and back to WSL 2 once done. Alternatively, you can refer to [this post to setup `wsl-vpnkit` from the Windows side](https://github.com/sakai135/wsl-vpnkit/issues/11#issuecomment-777806102).
8
-
9
-
### Install `vpnkit.exe` and `vpnkit-tap-vsockd`
10
-
11
-
This will download and extract `vpnkit.exe` and `vpnkit-tap-vsockd` from the [Docker Desktop for Windows installer](https://docs.docker.com/docker-for-windows/install/). Alternatively, build `vpnkit.exe` and `vpnkit-tap-vsockd` from [VPNKit](https://github.com/moby/vpnkit).
Download the prebuilt file `wsl-vpnkit.tar.gz` from the [latest release](https://github.com/sakai135/wsl-vpnkit/releases/latest) and import the distro into WSL 2. Running the distro will show a short intro and exit.
Start `wsl-vpnkit` from Windows or your other WSL 2 distros. Add the command to your `.profile` or `.bashrc` to start `wsl-vpnkit` when you open your WSL terminal.
45
17
46
18
```sh
47
-
sudo apt install socat
19
+
wsl.exe -d wsl-vpnkit service wsl-vpnkit start
48
20
```
49
21
50
-
### Configure DNS for WSL
22
+
### Notes
51
23
52
-
Disable WSL from generating and overwriting `/etc/resolv.conf` with the [network options in `wsl.conf`](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#network).
24
+
* Services on the WSL 2 VM are accessible from the Windows host using `localhost`.
25
+
* Services on the Windows host are accessible from WSL 2 using `host.internal`.
53
26
54
-
```sh
55
-
sudo tee /etc/wsl.conf <<EOL
56
-
[network]
57
-
generateResolvConf = false
58
-
EOL
59
-
```
27
+
### Uninstall
60
28
61
-
Shutdown the WSL2 VM and reopen your shell for `wsl.conf` to take effect.
29
+
To uninstall, unregister the distro.
62
30
63
-
```sh
64
-
wsl.exe --shutdown
31
+
```pwsh
32
+
wsl --unregister wsl-vpnkit
33
+
rm -r $env:USERPROFILE\wsl-vpnkit
65
34
```
66
35
67
-
Manually set DNS servers to use when not running `wsl-vpnkit`. [`1.1.1.1`](https://1.1.1.1/dns/) is provided here as an example.
In some environments, explicitly pass the environment variable `WSL_INTEROP` to `sudo`.
91
-
92
-
```sh
93
-
sudo --preserve-env=WSL_INTEROP ./wsl-vpnkit
94
-
```
95
-
96
-
Services on the WSL 2 VM should be accessible from the Windows host using `localhost` through [the WSL networking integrations](https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-insiders-preview-build-18945/#use-localhost-to-connect-to-your-linux-applications-from-windows) which can be configured by the [`localhostForwarding` option in `.wslconfig`](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#wsl-2-settings). Services on the Windows host should be accessible from WSL 2 using the IP from `VPNKIT_HOST_IP` (`192.168.67.2`).
97
-
98
-
## Run in the Background
99
-
100
-
This uses `wsl.exe` and `start-stop-daemon` to run `wsl-vpnkit` in the background. A log file will be created at `/var/log/wsl-vpnkit.log` with the output from `wsl-vpnkit`.
101
-
102
-
```sh
103
-
sudo ./wsl-vpnkit.service start
104
-
```
105
-
106
-
## Run as a Service
107
-
108
-
This is an example setup to run `wsl-vpnkit` as a service.
If VS Code takes a long time to open your folder in WSL, [enable the setting "Connect Through Localhost"](https://github.com/microsoft/vscode-docs/blob/main/remote-release-notes/v1_54.md#fix-for-wsl-2-connection-issues-when-behind-a-proxy).
0 commit comments