[memo]VPN_connection_in_WSL2

Posted on

Cisco AnyConnect を用いて VPN 接続を確立させると、 WSL2 上で起動している X server への接続が失われる。

これの対策を調べていたところ、以下のようなコメントが見つかった。 まだ試していないが、これで動作するならハッピーだ。

For anyone having problems with Cisco AnyConnect, using either the Cisco AnyConnect from Windows Store (now supports 2FA, as jamespotz said) worked for me after I rebooted computer (didnt work first time I tried it).

Also, as an alternative, using OpenConnect (which supports Cisco AnyConnect) windows 10 client https://github.com/openconnect/openconnect-gui/releases/tag/v1.5.3 also works for me (with 2fa) for DNS resolving, connectivity etc.

If you dont need the VPN in Windows and only in WSL2 env, you can install OpenConnect in WSL2 and connect to VPN with: sudo openconnect –no-dtls -b -u your_username vpn.hostname.domain

It will create a working VPN connection in WSL2 env.

https://github.com/microsoft/WSL/issues/4277#issuecomment-703070493