Microsoft Windows XP
[Version 5.1.2600
](C) Copyright 1986-2001 Microsoft Corp.
C
:\WINDOWS>netsh firewall add portopening ?
add portopening
[ protocol =
] TCP
|UDP
|ALL
[ port =
] 1-65535
[ name =
] name
[ [ mode =
] ENABLE
|DISABLE
[ scope =
] ALL
|SUBNET
|CUSTOM
[ addresses =
] addresses
[ profile =
] CURRENT
|DOMAIN
|STANDARD
|ALL
[ interface =
] name
]
添加防火墙端口配置。
参数
:
protocol - 端口协议。
TCP - 传输控制协议(TCP)。
UDP - 用户数据报协议(UDP)。
ALL - All 协议。
port - 端口号。
name - 端口名。
mode - 端口模式(可选)。
ENABLE - 允许通过防火墙(默认值)。
DISABLE - 不允许通过防火墙(默认值)。
mode - 端口范围(可选)。
ENABLE - 允许所有流量通过防火墙(默认值)。
SUBNET - 只允许本地网络(子网)流量通过防火墙。
CUSTOM - 只允许指定的流量通过防火墙。
addresses - 自定义范围地址(可选)。
profile - 配置的配置文件(可选)。
CURRENT - 当前配置文件(默认值)。
DOMAIN - 域配置文件。
STANDARD - 标准配置文件。
ALL - 所有配置文件。
name - 接口名(可选)。
备注
: 'profile' 和 'interface' 不能一起指定。
'scope' 和 'interface' 不能一起指定。
'scope' 必须是 'CUSTOM' 才能指定 'addresses'。
示例
:
add portopening TCP 80 MyWebPort
add portopening UDP 500 IKE ENABLE ALL
add portopening ALL 53 DNS ENABLE CUSTOM
157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet
add portopening protocol = TCP port = 80 name = MyWebPort
add portopening protocol = UDP port = 500 name = IKE mode = ENABLE scope = ALL
add portopening protocol = ALL port = 53 name = DNS mode = ENABLE
scope = CUSTOM addresses =
157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet