Created
August 15, 2020 08:54
-
-
Save ik11235/8d423072d9a15ed8504a8f0f3d6917d9 to your computer and use it in GitHub Desktop.
wsl2→windowsホストマシンへのアクセスをすべて許可するやーつ
This file contains 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 characters
# 過去に作成したルールを削除する | |
Remove-NetFirewallRule -DisplayName "WSL-access-approval" | |
# 現在のwslマシンのIPアドレスを取得、そのアドレスからのアクセスはすべて許可する | |
$wsl_ip_accress = wsl bash -c "ip addr show dev eth0 | grep -v inet6 |grep inet |cut -d / -f 1 | sed 's/^ *\| *$//' |cut -d ' ' -f 2" | |
New-NetFirewallRule -DisplayName "WSL-access-approval" -Direction Inbound -RemoteAddress ${wsl_ip_accress} -Action Allow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment