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 - 所有的通訊協定。
port - 連接埠編號。
name - 連接埠名稱。
mode - 連接埠模式 (可省略)。
ENABLE - 允許通過防火牆。
DISABLE - 不允許通過防火牆。
scope - 程式領域 (可省略)。
ALL - 允許所有流量通過防火牆 (預設)。
SUBNET - 只允許本機網路 (子網路) 流量通過防火牆。
CUSTOM - 只允許指定的流量通過防火牆。
addresses - 自訂領域位址 (可省略)。
profile - 組態設定檔 (可省略)。
CURRENT - 目前的設定檔 (預設)。
DOMAIN - 網域設定檔。
STANDARD - 標準設定檔。
ALL - 所有設定檔。
interface - 介面名稱 (可省略)。
備註
: '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