Get-NetFirewallRule
注意Windows FW規則の確認・作成
Get-NetFirewallRule -DisplayName '*remote*'
ファイアウォール規則の照会と作成。netsh advfirewallの後継で、「ポートが開いていない」調査と開放を正攻法で行う。
実行例
New-NetFirewallRule -DisplayName 'App 8080' -Direction Inbound -LocalPort 8080 -Protocol TCP -Action Allow8080番を開放
書式
Get-NetFirewallRule [-Enabled True] / New-NetFirewallRule -DisplayName n -Direction Inbound -LocalPort p -Protocol TCP -Action Allow
実行前の注意
開放は必要最小限のポート・範囲で。
関連コマンド
- netshネットワーク設定の総合操作
- firewall-cmdfirewalld操作(RHEL系)