1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSL2に外部からアクセスしたい

Posted at

#WSL2に外部からアクセスする

ひとまず備忘録後で編集する
基本的にはpowershell管理者権限実行

やること
ファイアーウォールの設定
開放

$ New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort 22 -Action Allow -Protocol TCP
$ New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort 22 -Action Allow -Protocol TCP

設定削除

$ Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock'

ポートフォワード設定
ここでは22番

$ netsh interface portproxy add v4tov4 listenport=22 connectport=22 connectaddres=(wsl hostname -I).trimend() 

確認方法

$ netsh.exe interface portproxy show v4tov4

設定削除

$ netsh.exe interface portproxy delete v4tov4 listenport=22
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?