端口设置涉及的一些命令

用netstat -an查看监听的端口

netsh firewall show state
netsh firewall show config

用netsh.exe程序设置端口:

数据收集

收起该表格展开该表格
命令 说明
show allowedprogram 显示允许的程序。
show config 显示详细的本地配置信息。
show currentprofile 显示当前配置文件。
show icmpsetting 显示 ICMP 设置。
show logging 显示日志记录设置。
show opmode 显示操作模式。
show portopening 显示例外端口。
show service 显示服务。
show state 显示当前的状态信息。
show notifications 显示当前通知设置。


配置

收起该表格展开该表格
命令 说明
add allowedprogram 用于通过指定程序的文件名来添加例外通信。
set allowedprogram 用于修改现有允许的程序的设置。
delete allowedprogram 用于删除现有允许的程序。
set icmpsetting 用于指定允许的 ICMP 通信。
set logging 用于为 Windows 防火墙指定全局日志记录选项,或为特定连接(接口)指定日志记录选项。
set opmode 用于为 Windows 防火墙指定全局操作模式,或为特定连接(接口)指定操作模式。
add portopening 用于通过指定 TCP 或 UDP 端口来添加例外通信。
set portopening 用于修改现有打开的 TCP 或 UDP 端口的设置。
delete portopening 用于删除现有打开的 TCP 或 UDP 端口。
set service 用于启用或丢弃 RPC 和 DCOM 通信、文件和打印机共享以及 UPnP 通信。
set notifications 用于指定当程序试图打开端口时是否通知用户。
reset 将防火墙配置重置为默认设置。它提供与“Windows 防火墙”界面中的“还原为默认值”按钮相同的功能。

例如:

netsh firewall add portopening TCP 端口号 端口名称

netsh firewall delete portopening TCP 端口号

netsh firewall set portopening TCP 端口号 更改之后的名称

猜你喜欢

转载自www.cnblogs.com/hzjdpawn/p/11774206.html