Last active
February 2, 2024 03:45
-
-
Save 844196/73a9d7319cf9248248e31f63293b16a5 to your computer and use it in GitHub Desktop.
Revisions
-
844196 revised this gist
Feb 2, 2024 . 1 changed file with 0 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,5 @@ # WSL 動かない なぜ 令和最新版 ## スワップをなるべく使わないようにする -
844196 created this gist
Aug 23, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ # WSL 動かない なぜ 令和最新版 ## VPN接続時のデフォルトMTUサイズを変える i.e. VPN接続中にWSL2から外のホストに対してSSHできるようにする 1. VPNの設定をする 1. VPN接続する 1. 管理者権限でコマンドプロンプトを開く 1. `netsh interface ipv4 show interface` を実行してVPNの `Idx` を控える 1. `netsh interface ipv4 set interface {さっき控えたIdx} mtu={設定したいMTUサイズ}` を実行する 1. とりあえずWindowsを1回再起動する 1. VPNに接続していない状態で、WSL2から `ip addr` してMTUサイズが `1500` (WindowsのPPP接続時デフォルトMTUサイズ) になっていることを確認する 1. VPNに接続している状態で、WSL2から `ip addr` してMTUサイズが設定した値になっていることを確認する SEE ALSO: https://learn.microsoft.com/ja-jp/troubleshoot/windows-client/networking/change-default-mtu-size-for-ppp-vpn-connection ## スワップをなるべく使わないようにする 先にWSL2でsystemdが使えることを確認しておくこと 1. WSL2で `/etc/sysctl.conf` を開いて、末尾に設定を追加して保存する ```bash sudo vim /etc/sysctl.conf ``` ```ini vm.swappiness=1 ``` 1. コマンドプロンプトを開いて `wsl --shutdown` を実行し、WSL2を再起動する 1. WSL2で `cat /proc/sys/vm/swappiness` を実行し設定した `1` が返ってくることを確認する ```console $ cat /proc/sys/vm/swappiness 1 ``` ## ブラウザが自動起動する系のコマンドをWSL2でも使えるようにする 1. [`wslu`](https://wslutiliti.es/wslu/install.html#ubuntu) をインストールする 1. どこかで `BROWSER` 環境変数に `wslview` をセットする ```bash # .zshenv.local BROWSER=wslview ```