对来自特定 IP 地址的所有连接打开 Windows 防火墙

Aid*_*ght 15 firewall windows-server-2008-r2 rules whitelist ipv4

是否可以将 Windows 防火墙中的 IP 地址“列入白名单”并允许来自该特定地址的所有连接?

Mar*_*son 17

假设您要列入白名单的 IP 地址是192.0.2.55

netsh advfirewall firewall add rule name="Allow from 192.0.2.55" dir=in action=allow protocol=ANY remoteip=192.0.2.55
Run Code Online (Sandbox Code Playgroud)


aus*_*sip 6

这是从 Powershell 执行此操作的方法

New-NetFirewallRule -Name Allow192.0.2.55 -DisplayName 'Allow from 192.0.2.55' -Enabled True -Direction Inbound -Protocol ANY -Action Allow -Profile ANY -RemoteAddress 192.0.2.55
Run Code Online (Sandbox Code Playgroud)