LoginSignup
1
0

WSL2 へポートフォワーディングする方法

Posted at

DOSプロンプトを管理者権限で実行します。

ホスト側のポートをWSL2側のポートへ転送する設定

netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=[WSL2のIPアドレス]

その確認

netsh interface portproxy show all
netsh interface portproxy show all

ipv4 をリッスンする:         ipv4 に接続する:

Address         Port        Address         Port
--------------- ----------  --------------- ----------
0.0.0.0         8080        172.xxx.xxx.xxx 8080

ポート転送設定を削除する方法

ポート転送設定を確認

netsh interface portproxy show all
netsh interface portproxy show all

ipv4 をリッスンする:         ipv4 に接続する:

Address         Port        Address         Port
--------------- ----------  --------------- ----------
0.0.0.0         8080        172.xxx.xxx.xxx 8080

ポート転送設定を削除

netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=0.0.0.0

削除結果の確認

netsh interface portproxy show all
1
0
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
0