Windows 防火墙默认都是开启的,如果想要进一步控制服务器,修改防火墙策略显得非常必要。有必要用 Netsh 命令对高级的 Windows 防火墙规则进行定义。当然也可以制作服务器加固的批处理。 <nowiki> //给防火墙添加允许 TCP 3389 端口通过 netsh advfirewall firewall add rule name=Windows Security Port dir=in action=allow protocol=TCP localport=3389 //删除防火墙所有针对 TCP 8080 端口入站的规则 netsh advfirewall firewall delete rule name=all dir=in protocol=TCP localport=8080 //直接重设防火墙策略到默认状态 netsh advfirewall reset //关闭防火墙所有规则 netsh advfirewall set allprofiles state off //将入站默认规则设置成阻挡并允许出站 netsh advfirewall set allprofiles firewallpolicy blackinbound,allowoutbound //将本地的3389端口的数据转发至<公网IP>上的8080端口 netsh interface portproxy add v4tov4 listenport=3389 connectaddress=<公网IP> connectport=8080 //将本地3389端口的数据改成转发至<公网IP>的9080端口 netsh interface portproxy set v4tov4 listenport=3389 connectaddress=<公网IP> connectport=9080 //显示所有IPv4端口代理参数 netsh interface portproxy show v4tov4 //删除本地端口3389的端口转发配置 netsh interface portproxy delete v4tov4 listenport=3389 |
|
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系
[邮箱地址] 删除
|