在Windows系统中,可以使用netsh和PowerShell命令行工具来设置和管理防火墙。以下是具体步骤和命令示例:
netsh命令设置Windows防火墙启用或禁用防火墙:
netsh advfirewall set allprofiles state on
netsh advfirewall set allprofiles state off
设置防火墙配置文件:
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
Set-NetFirewallProfile -DefaultInboundAction Block -DefaultOutboundAction Allow -NotifyOnListen False
添加新的入站规则:
netsh advfirewall firewall add rule name="Allow HTTP" protocol=TCP dir=in localport=80 action=allow
删除规则:
netsh advfirewall firewall delete rule name="Allow HTTP"
查看防火墙状态:
netsh advfirewall show allprofiles state
PowerShell命令设置Windows防火墙启用或禁用防火墙:
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
查看防火墙规则:
Get-NetFirewallRule
创建新的入站规则:
New-NetFirewallRule -DisplayName "Allow HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
删除规则:
Remove-NetFirewallRule -DisplayName "Allow HTTP"
通过上述命令,您可以在命令行界面灵活地管理Windows防火墙的设置,以满足不同的安全需求。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。