Microsoft Windows [Version 10.0.19045.3570]
(c) Microsoft Corporation. C:\Windows>netsh advfirewall ? 下列指令有效: 此上下文中的命令: ? - 显示命令列表。 consec - 更改到 `netsh advfirewall consec' 上下文。 dump - 显示一个配置脚本。 export - 将当前策略导出到文件。 firewall - 更改到 `netsh advfirewall firewall' 上下文。 help - 显示命令列表。 import - 将策略文件导入当前策略存储。 mainmode - 更改到 `netsh advfirewall mainmode' 上下文。 monitor - 更改到 `netsh advfirewall monitor' 上下文。 reset - 将策略重置为默认全新策略。 set - 设置每个配置文件或全局设置。 show - 显示配置文件或全局属性。 下列的子上下文可用: consec firewall mainmode monitor 若需要命令的更多帮助信息,请键入命令,接着是空格, 后面跟 ?。
更改到 `netsh advfirewall consec' 上下文。
»netsh »advfirewall »consec
C:\Windows>netsh advfirewall consec ? 下列指令有效: 此上下文中的命令: ? - 显示命令列表。 add - 添加新连接安全规则。 delete - 删除所有匹配的连接安全规则。 dump - 显示一个配置脚本。 help - 显示命令列表。 set - 为现有规则的属性设置新值。 show - 显示指定的连接安全规则。 若需要命令的更多帮助信息,请键入命令,接着是空格, 后面跟 ?。
添加新连接安全规则。
»netsh »advfirewall »consec »add
C:\Windows>netsh advfirewall consec add ? 下列指令有效: 此上下文中的命令: add rule - 添加新连接安全规则。
添加新连接安全规则。
»netsh »advfirewall »consec »add »rule
C:\Windows>netsh advfirewall consec add rule ? 用法: add rule name=<string> endpoint1=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list> endpoint2=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list> action=requireinrequestout|requestinrequestout| requireinrequireout|requireinclearout|noauthentication [description=<string>] [mode=transport|tunnel (default=transport)] [enable=yes|no (default=yes)] [profile=public|private|domain|any[,...] (default=any)] [type=dynamic|static (default=static)] [localtunnelendpoint=any|<IPv4 address>|<IPv6 address>] [remotetunnelendpoint=any|<IPv4 address>|<IPv6 address>] [port1=0-65535|<port range>[,...]|any (default=any)] [port2=0-65535|<port range>[,...]|any (default=any)] [protocol=0-255|tcp|udp|icmpv4|icmpv6|any (default=any)] [interfacetype=wiresless|lan|ras|any (default=any)] [auth1=computerkerb|computercert|computercertecdsap256| computercertecdsap384|computerpsk|computerntlm|anonymous[,...]] [auth1psk=<string>] [auth1kerbproxyfqdn=<fully-qualified dns name>] [auth1ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] |..."] [auth1healthcert=yes|no (default=no)] [auth1ecdsap256ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap256healthcert=yes|no (default=no)] [auth1ecdsap384ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap384healthcert=yes|no (default=no)] [auth2=computercert|computercertecdsap256|computercertecdsap384| userkerb|usercert|usercertecdsap256|usercertecdsap384|userntlm| anonymous[,...]] [auth2kerbproxyfqdn=<fully-qualified dns name>] [auth2ca="<CA Name> [certmapping:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth2ecdsap256ca="<CA Name> [certmapping:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth2ecdsap384ca="<CA Name> [certmapping:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [qmpfs=dhgroup1|dhgroup2|dhgroup14|dhgroup24|ecdhp256|ecdhp384| mainmode|none (default=none)] [qmsecmethods=authnoencap:<integrity>+[valuemin]+[valuekb]| ah:<integrity>+esp:<integrity>-<encryption>+[valuemin]+[valuekb] |default] [exemptipsecprotectedconnections=yes|no (default=no)] [applyauthz=yes|no (default=no)] 备注: - 规则名称应该唯一且不能为 "all"。 - 当 mode=tunnel 时,必须指定隧道终结点,操作为 noauthentication 时除外。 当输入特定 IP 地址时,这些地址必须是相同的 IP 版本。 此外,当配置动态隧道时: 可以将隧道终结点设置为 any。不需要为 客户端策略指定本地隧道终结点(即 any)。 不需要为网关策略指定远程隧道终结点(即 any)。 此外,操作必须为 requireinrequireout、requireinclearout 或 noauthentication。 - 当 mode=Transport 时 requireinclearout 无效。 - 必须至少指定一个身份验证。 - Auth1 和 auth2 可以是用逗号分隔的选项列表。 - 不可以为 auth1 同时指定 Computerpsk 和 computerntlm 方法。 - 不可以将 Computercert 与 auth2 的用户凭据一起指定。 - 仅在 Windows Vista SP1 及更高版本上 支持 Certsigning 选项 ecdsap256 和 ecdsap384。 - Qmsecmethods 可以是由 "," 分隔的建议列表。 - 对于 qmsecmethods,integrity=md5|sha1|sha256|aesgmac128|aesgmac192| aesgmac256|aesgcm128|aesgcm192|aesgcm256 和 encryption=3des|des|aes128|aes192|aes256|aesgcm128|aesgcm192|aesgcm256 - 如果指定 aesgcm128、aesgcm192 或 aesgcm256,则它必须 用于 ESP 完整性和加密。 - 仅在 Windows Vista SP1 及更高版本上支持 Aesgmac128、aesgmac192、 aesgmac256、aesgcm128、aesgcm192、aesgcm256、sha256。 - Qmpfs=mainmode 使用 PFS 的主模式密钥交换设置。 - 不建议使用 DES、MD5 和 DHGroup1。提供这些加密算法仅用于向下兼容。 - certmapping 和 excludecaname 的默认值为 "no"。 - 必须将 CA 名称中的 " 字符替换为 \' - 对于 auth1ca 和 auth2ca,CA 名称必须以 "CN=" 为前缀。 - 可以使用 catype 来指定证书颁发机构类型 - catype=root/intermediate - 在 Windows 7 及更高版本上支持 authnoencap。 - authnoencap 表示计算机将仅使用身份验证, 将不使用任何每个数据包封装或加密算法 来保护随后作为此连接的一部分交换的网络数据包。 - 不能在还嬖蛏贤笔褂?QMPFS 和 authnoencap。 - AuthNoEncap 必须至少和一个 AH 或 ESP 完整性套件一起使用。 - 只能为隧道模式规则指定 applyauthz。 - 只能为隧道模式规则指定 exemptipsecprotectedconnections。 通过将此标志设置为“是”,将从隧道中免除 ESP 流量。 仅 AH 流量将不会从隧道中免除。 - qmsecmethod 的 Valuemin(指定时)应介于 5-2880 分钟之间。 qmsecmethod 的 Valuekb(指定时)应介于 20480-2147483647 KB 之间。 - Certhash 指定证书的指纹或证书的哈希。 - Followrenewal 指定是否自动跟随证书中的可续订链接。仅适用于 证书部分(需要 certhash)。 - Certeku 指定要在证书中匹配的用逗号分隔的 EKU OID 列表。 - Certname 指定要匹配证书名称的字符串(需要 certnametype)。 - Certnametype 指定要匹配的 certname 的证书字段(需要 certname)。 - Certcriteriatype 指定当选择本地证书、验证对等证书或两者都执行 时是否对证书采取操作。 - 在 computercert 身份验证映射内,可以通过用 "|" 字符分隔每个 条目来引用多个证书。 示例: 使用默认值为域隔离添加规则: netsh advfirewall consec add rule name="isolation" endpoint1=any endpoint2=any action=requireinrequestout 使用自定义快速模式建议添加规则: netsh advfirewall consec add rule name="custom" endpoint1=any endpoint2=any qmsecmethods=ah:sha1+esp:sha1-aes256+60min+20480kb,ah:sha1 action=requireinrequestout 使用自定义快速模式建议添加规则: netsh advfirewall consec add rule name="custom" endpoint1=any endpoint2=any qmsecmethods=authnoencap:sha1,ah:aesgmac256+esp:aesgmac256-none action=requireinrequestout 创建从 子网 A (192.168.0.0, external ip=1.1.1.1)到 子网 B (192.157.0.0, external ip=2.2.2.2)的隧道模式规则: netsh advfirewall consec add rule name="my tunnel" mode=tunnel endpoint1=192.168.0.0/16 endpoint2=192.157.0.0/16 remotetunnelendpoint=2.2.2.2 localtunnelendpoint=1.1.1.1 action=requireinrequireout 创建从子网 A (192.168.0.0/16)到 子网 B (192.157.0.0, remoteGW=2.2.2.2)的动态隧道模式规则 客户端策略: netsh advfirewall consec add rule name="dynamic tunnel" mode=tunnel endpoint1=any endpoint2=192.157.0.0/16 remotetunnelendpoint=2.2.2.2 action=requireinrequireout 网关策略(仅适用于网关设备): netsh advfirewall consec add rule name="dynamic tunnel" mode=tunnel endpoint1=192.157.0.0/16 endpoint2=any localtunnelendpoint=2.2.2.2 action=requireinrequireout 使用 CA 名称添加规则: netsh advfirewall consec add rule name="cert rule" endpoint1=any endpoint2=any action=requireinrequestout auth1=computercert auth1ca="C=US, O=MSFT, CN=\'Microsoft North, South, East, and West Root Authority\'" 使用各种证书条件以及多种身份验证方法 添加规则: netsh advfirewall consec add rule name="cert rule" endpoint1=any endpoint2=any action=requireinrequireout auth1=computercert auth1ca="CN=\'CN1\' certcriteriatype:Selection certname:MyGroup certnametype:SubjectOU certeku:1.2.3.4.5|CN=\'CN2\' certcriteriatype:Validation certeku:2.3.4.5.6,9.10.11.12|CN=\'CN3\' certhash:0123456789abcdef01234567890ABCDEF0123456"
删除所有匹配的连接安全规则。
»netsh »advfirewall »consec »delete
C:\Windows>netsh advfirewall consec delete ? 下列指令有效: 此上下文中的命令: delete rule - 删除所有匹配的连接安全规则。
删除所有匹配的连接安全规则。
»netsh »advfirewall »consec »delete »rule
C:\Windows>netsh advfirewall consec delete rule ? 用法: delete rule name=<string> [type=dynamic|static] [profile=public|private|domain|any[,...] (default=any)] [endpoint1=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [endpoint2=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [port1=0-65535|<port range>[,...]|any (default=any)] [port2=0-65535|<port range>[,...]|any (default=any)] [protocol=0-255|tcp|udp|icmpv4|icmpv6|any] 注释: - 删除按名称识别的规则,也可按配置文件、 终结点、端口、协议和类型识别。 - 如果找到多个匹配项,则删除所有匹配规则。 示例: 从所有配置文件中删除名称为 "rule1" 的规则: netsh advfirewall consec delete rule name="rule1" 从所有配置文件中删除所有动态规则: netsh advfirewall consec delete rule name=all type=dynamic
显示一个配置脚本。
»netsh »advfirewall »consec »dump
C:\Windows>netsh advfirewall consec dump ? 用法: dump 说明: 创建一个包含当前配置的脚本文件。如果保存到 文件,此脚本可以用来还原更改的配置设置。
显示命令列表。
»netsh »advfirewall »consec »help
C:\Windows>netsh advfirewall consec help ? 用法: help 说明: 显示命令列表。
为现有规则的属性设置新值。
»netsh »advfirewall »consec »set
C:\Windows>netsh advfirewall consec set ? 下列指令有效: 此上下文中的命令: set rule - 为现有规则的属性设置新值。
为现有规则的属性设置新值。
»netsh »advfirewall »consec »set »rule
C:\Windows>netsh advfirewall consec set rule ? 用法: set rule group=<string> | name=<string> [type=dynamic|static] [profile=public|private|domain|any[,...] (default=any)] [endpoint1=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [endpoint2=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [port1=0-65535|<port range>[,...]|any] [port2=0-65535|<port range>[,...]|any] [protocol=0-255|tcp|udp|icmpv4|icmpv6|any] new [name=<string>] [profile=public|private|domain|any[,...]] [description=<string>] [mode=transport|tunnel] [endpoint1=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [endpoint2=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [action=requireinrequestout|requestinrequestout| requireinrequireout|requireinclearout|noauthentication] [enable=yes|no] [type=dynamic|static] [localtunnelendpoint=any|<IPv4 address>|<IPv6 address>] [remotetunnelendpoint=any|<IPv4 address>|<IPv6 address>] [port1=0-65535|<port range>[,...]|any] [port2=0-65535|<port range>[,...]|any] [protocol=0-255|tcp|udp|icmpv4|icmpv6|any] [interfacetype=wiresless|lan|ras|any] [auth1=computerkerb|computercert|computercertecdsap256| computercertecdsap384|computerpsk|computerntlm|anonymous[,...]] [auth1psk=<string>] [auth1kerbproxyfqdn=<fully-qualified dns name>] [auth1ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1healthcert=yes|no] [auth1ecdsap256ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap256healthcert=yes|no (default=no)] [auth1ecdsap384ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap384healthcert=yes|no (default=no)] [auth2=computercert|computercertecdsap256|computercertecdsap384| userkerb|usercert|usercertecdsap256|usercertecdsap384|userntlm| anonymous[,...]] [auth2kerbproxyfqdn=<fully-qualified dns name>] [auth2ca="<CA Name> [certmapping:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth2ecdsap256ca="<CA Name> [certmapping:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth2ecdsap384ca="<CA Name> [certmapping:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [qmpfs=dhgroup1|dhgroup2|dhgroup14|dhgroup24|ecdhp256|ecdhp384| mainmode|none] [qmsecmethods=authnoencap:<integrity>+[valuemin]+[valuekb]| ah:<integrity>+esp:<integrity>-<encryption>+[valuemin]+[valuekb] |default] [exemptipsecprotectedconnections=yes|no (default=no)] [applyauthz=yes|no (default=no)] 备注: - 为已标识的规则设置新的参数值。如果规则不存在, 则该命令失败。若要创建规则,请使用添加命令。 - 会更新规则中 new 关键字后的值。如果没有值, 或缺少关键字 new,则不进行任何更改。 - 只能启用或禁用一组规则。 - 如果多个规则与条件匹配,将更新所有 匹配的规则。 - 规蛎朴Ω梦ㄒ磺也荒芪?"all"。 - Auth1 和 auth2 可以是用逗号分隔的选项列表。 - 无法为 auth1 同时指定 Computerpsk 和 computerntlm 方法。 - 无法将 Computercert 与 auth2 的用户凭据一起指定。 - 仅在 Windows Vista SP1 及更高版本上 支持 Certsigning 选项 ecdsap256 和 ecdsap384。 - Qmsecmethods 可以是由 "," 分隔的建议列表。 - 对于 qmsecmethods,integrity=md5|sha1|sha256|aesgmac128|aesgmac192| aesgmac256|aesgcm128|aesgcm192|aesgcm256 和 encryption=3des|des|aes128|aes192|aes256|aesgcm128|aesgcm192| aesgcm256。 - 如果指定 aesgcm128、aesgcm192 或 aesgcm256,则它必须 用于 ESP 完整性和加密。 - 仅 Windows Vista SP1 及更高版本上支持 Aesgmac128、aesgmac192、 aesgmac256、aesgcm128、aesgcm192、aesgcm256、sha256。 - 如果 qmsemethods 设置为默认值,则 qmpfs 也将设置为默认值。 - Qmpfs=mainmode 使用 PFS 的主模式密钥交换设置。 - 不建议使用 DES、MD5 和 DHGroup1。提供 这些加密算法仅用于向下兼容。 - 必须将 CA 名称中的 " 字符替换为 \' - 对于 auth1ca 和 auth2ca,CA 名称必须以 "CN=" 为前缀。 - 可以使用 catype 来指定证书颁发机构类型 - catype=root/intermediate - 在 Windows 7 及更高版本上支持 authnoencap。 - authnoencap 表示计算机将仅使用身份验证, 将不会使用任何每个数据包封装或加密算法 来保护随后作为此连接的一部分交换的网络数据包。 - 无法在同一规则上同时使用 QMPFS 和 authnoencap。 - AuthNoEncap 必须至少和一个 AH 或 ESP 完整性套件一起使用。 - 当 mode=tunnel 时,操作必须是 requireinrequireout、 requireinclearout 或 noauthentication。 - 当 mode=Transport 时,requireinclearout 无效。 - 只能为隧道模式规则指定 applyauthz。 - 只能为隧道模式规则指定 exemptipsecprotectedconnections。 通过将此标志设置为“是”,将从隧道中免除 ESP 流量。 仅 AH 流量将不会从隧道中免除。 - 当 mode=transport 时,只能指定 Port1、Port2 和 Protocol。 - qmsecmethod 的 Valuemin(指定时)应介于 5-2880 分钟之间。 qmsecmethod 的 Valuekb(指定时)应介于 20480-2147483647 KB 之间。 - Certhash 指定证书的指纹或哈希。 - Followrenewal 指定是否自动跟随证书中的可续订链接。仅适用于 证书部分(需要 certhash)。 - Certeku 指定要在证书中匹配的用逗号分隔的 EKU OID 列表。 - Certname 指定要匹配证书名称的字符串(需要 certnametype)? - Certnametype 指定要匹配的 certname 的证书字段(需要 certname)。 - Certcriteriatype 指定当选择本地证书、验证对等证书或两者都执行 时是否对证书采取操作。 示例: 将 rule1 重命名为 rule2: netsh advfirewall consec set rule name="rule1" new name="rule2" 更改规则的操作: netsh advfirewall consec set rule name="rule1" endpoint1=1.2.3.4 endpoint2=4.3.2.1 new action=requestinrequestout 使用自定义快速模式建议添加规则: netsh advfirewall consec set rule name="Custom QM" new endpoint1=any endpoint2=any qmsecmethods=authnoencap:aesgmac256,ah:aesgmac256+esp:aesgmac256-none
显示指定的连接安全规则。
»netsh »advfirewall »consec »show
C:\Windows>netsh advfirewall consec show ? 下列指令有效: 此上下文中的命令: show rule - 显示指定的连接安全规则。
显示指定的连接安全规则。
»netsh »advfirewall »consec »show »rule
C:\Windows>netsh advfirewall consec show rule ? 用法: show rule name=<string> [profile=public|private|domain|any[,...]] [type=dynamic|static (default=static)] [verbose] 注释: - 显示按名称识别的所有规则实例, 也可按配置文件和类型识别。 示例: 显示所有规则: netsh advfirewall consec show rule name=all 显示所有动态规则: netsh advfirewall consec show rule name=all type=dynamic
显示一个配置脚本。
»netsh »advfirewall »dump
C:\Windows>netsh advfirewall dump ? 用法: dump 说明: 创建一个包含当前配置的脚本文件。如果保存到 文件,此脚本可以用来还原更改的配置设置。
将当前策略导出到文件。
»netsh »advfirewall »export
C:\Windows>netsh advfirewall export ? 用法: export <path\filename> 注释: - 将当前策略导出到指定文件。 示例: netsh advfirewall export "c:\advfirewallpolicy.pol"
更改到 `netsh advfirewall firewall' 上下文。
»netsh »advfirewall »firewall
C:\Windows>netsh advfirewall firewall ? 下列指令有效: 此上下文中的命令: ? - 显示命令列表。 add - 添加新入站或出站防火墙规则。 delete - 删除所有匹配的防火墙规则。 dump - 显示一个配置脚本。 help - 显示命令列表。 set - 为现有规则的属性设置新值。 show - 显示指定的防火墙规则。 若需要命令的更多帮助信息,请键入命令,接着是空格? 后面跟 ?。
添加新入站或出站防火墙规则。
»netsh »advfirewall »firewall »add
C:\Windows>netsh advfirewall firewall add ? 下列指令有效: 此上下文中的命令: add rule - 添加新入站或出站防火墙规则。
添加新入站或出站防火墙规则。
»netsh »advfirewall »firewall »add »rule
C:\Windows>netsh advfirewall firewall add rule ? 用法: add rule name=<string> dir=in|out action=allow|block|bypass [program=<program path>] [service=<service short name>|any] [description=<string>] [enable=yes|no (default=yes)] [profile=public|private|domain|any[,...]] [localip=any|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [localport=0-65535|<port range>[,...]|RPC|RPC-EPMap|IPHTTPS|any (default=any)] [remoteport=0-65535|<port range>[,...]|any (default=any)] [protocol=0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code| tcp|udp|any (default=any)] [interfacetype=wireless|lan|ras|any] [rmtcomputergrp=<SDDL string>] [rmtusrgrp=<SDDL string>] [edge=yes|deferapp|deferuser|no (default=no)] [security=authenticate|authenc|authdynenc|authnoencap|notrequired (default=notrequired)] 备注: - 将新的入站或出站规则添加到防火墙策略。 - 规则名称应该是唯一的,且不能为 "all"。 - 如果已指定远程计算机或用户组,则 security 必须为 authenticate、authenc、authdynenc 或 authnoencap。 - 为 authdynenc 设置安全性可允许系统动态协商为匹配 给定 Windows Defender 防火墙规则的通信使用加密。 根据现有连接安全规则属性协商加密。 选择此选项后,只要入站 IPsec 连接已设置安全保护, 但未使用 IPsec 进行加密,计算机就能够接收该入站连接的第一个 TCP 或 UDP 包。 一旦处理了第一个数据包,服务器将重新协商连接并对其进行升级,以便所 有后续通信都完全加密。 - 如果 action=bypass,则 dir=in 时必须指定远程计算机组。 - 如果 service=any,则规则仅应用到服务。 - ICMP 类型或代码可以为 "any"。 - Edge 只能为入站规则指定。 - AuthEnc 和 authnoencap 不能同时使用。 - Authdynenc 仅当 dir=in 时有效。 - 设置 authnoencap 后,security=authenticate 选项就变成可选参数? 示例: 为不具有封装的 messenger.exe 添加入站规则: netsh advfirewall firewall add rule name="allow messenger" dir=in program="c:\programfiles\messenger\msmsgs.exe" security=authnoencap action=allow 为端口 80 添加出站规则: netsh advfirewall firewall add rule name="allow80" protocol=TCP dir=out localport=80 action=block 为 TCP 端口 80 通信添加需要安全和加密的入站规则: netsh advfirewall firewall add rule name="Require Encryption for Inbound TCP/80" protocol=TCP dir=in localport=80 security=authdynenc action=allow 为 messenger.exe 添加需要安全的入站规则: netsh advfirewall firewall add rule name="allow messenger" dir=in program="c:\program files\messenger\msmsgs.exe" security=authenticate action=allow 为 SDDL 字符串标识的组 acmedomain\scanners 添加 经过身份验证的防火墙跳过规则: netsh advfirewall firewall add rule name="allow scanners" dir=in rmtcomputergrp=<SDDL string> action=bypass security=authenticate 为 udp- 的本地端口 5000-5010 添加出站允许规则 Add rule name="Allow port range" dir=out protocol=udp localport=5000-5010 action=allow
删除所有匹配的防火墙规则。
»netsh »advfirewall »firewall »delete
C:\Windows>netsh advfirewall firewall delete ? 下列指令有效: 此上下文中的命令: delete rule - 删除所有匹配的防火墙规则。
删除所有匹配的防火墙规则。
»netsh »advfirewall »firewall »delete »rule
C:\Windows>netsh advfirewall firewall delete rule ? 用法: delete rule name=<string> [dir=in|out] [profile=public|private|domain|any[,...]] [program=<program path>] [service=<service short name>|any] [localip=any|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [localport=0-65535|<port range>[,...]|RPC|RPC-EPMap|any] [remoteport=0-65535|<port range>[,...]|any] [protocol=0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code| tcp|udp|any] 注释: - 删除按名称识别的规则,也可按终结点、端口、 协议和类型识别规则 - 如果找到多个匹配项,则删除所有匹配规则。 - 如果指定 name=all,则从指定的 类型和配置文件中删除泄嬖颉? 示例: 删除本地端口 80 的所有入则: netsh advfirewall firewall delete rule name=all protocol=tcp localport=80 删除名为 "allow80" 的规则: netsh advfirewall firewall delete rule name="allow80"
显示一个配置脚本。
»netsh »advfirewall »firewall »dump
C:\Windows>netsh advfirewall firewall dump ? 用法: dump 说明: 创建一个包含当前配置的脚本文件。如果保存到 文件,此脚本可以用来还原更改的配置设置。
显示命令列表。
»netsh »advfirewall »firewall »help
C:\Windows>netsh advfirewall firewall help ? 用法: help 说明: 显示命令列表。
为现有规则的属性设置新值。
»netsh »advfirewall »firewall »set
C:\Windows>netsh advfirewall firewall set ? 下列指令有效: 此上下文中的命令: set rule - 为现有规则的属性设置新值。
为现有规则的属性设置新值。
»netsh »advfirewall »firewall »set »rule
C:\Windows>netsh advfirewall firewall set rule ? 用法: set rule group=<string> | name=<string> [dir=in|out] [profile=public|private|domain|any[,...]] [program=<program path>] [service=service short name|any] [localip=any|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [localport=0-65535|<port range>[,...]|RPC|RPC-EPMap|IPHTTPS|any] [remoteport=0-65535|<port range>[,...]|any] [protocol=0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code| tcp|udp|any] new [name=<string>] [dir=in|out] [program=<program path> [service=<service short name>|any] [action=allow|block|bypass] [description=<string>] [enable=yes|no] [profile=public|private|domain|any[,...]] [localip=any|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [localport=0-65535|RPC|RPC-EPMap|any[,...]] [remoteport=0-65535|any[,...]] [protocol=0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code| tcp|udp|any] [interfacetype=wireless|lan|ras|any] [rmtcomputergrp=<SDDL string>] [rmtusrgrp=<SDDL string>] [edge=yes|deferapp|deferuser|no (default=no)] [security=authenticate|authenc|authdynenc|notrequired] 备注: - 为已识别的规则设置新的参数值。如果规则不存在, 则该命令失败。若要创建规则,请使用添加命令。 - 会更新规则中 new 关键字后的值。如果 没有值,或缺少关键字 new,则没有任何更改。 - 一组规则只能被启用或禁用。 - 如果多个规则与条件匹配,则会 更新所有匹配规则。 - 规则名称应该是唯一的,并且不能是 "all"。 - 如果指定远程计算机或用户组,security 必须 为 authenticate、authenc 或 authdynenc。 - 为 authdynenc 设置安全性可允许系统动态协商为匹配 给定 Windows Defender 防火墙规则的通信使用加密。 根据现有连接安全规则属性协商加密。 选择此选项后,只要入站 IPsec 连接已设置安全保护, 但未使用 IPsec 进行加密,计算机就能够接收该入站连接的第一个 TCP 或 UDP 包。 一旦处理了第一个数据包,服务器将重新协商连接并对其进行升级,以便 所有后续通信都完全加密。 - Authdynenc 仅当 dir=in 时有效。 - 如果 action=bypass,则当 dir=in 时必须指定远程计算机组。 - 如果 service=any,则规则只适用于服务。 - ICMP 类型或代码可以是 "any"。 - 只能为入站规则指定边缘。 示例: 根据名称为 "allow80" 的规则更改远程 IP 地址: netsh advfirewall firewall set rule name="allow80" new remoteip=192.168.0.2 启用带有分组字符串 "Remote Desktop" 的组: netsh advfirewall firewall set rule group="remote desktop" new enable=yes 为 udp- 更改规则 "Allow port range" 上的本地端口 Set rule name="Allow port range" dir=out protocol=udp localport=5000-5020 action=allow
显示指定的防火墙规则。
»netsh »advfirewall »firewall »show
C:\Windows>netsh advfirewall firewall show ? 下列指令有效: 此上下文中的命令: show rule - 显示指定的防火墙规则。
显示指定的防火墙规则。
»netsh »advfirewall »firewall »show »rule
C:\Windows>netsh advfirewall firewall show rule ? 用法: show rule name=<string> [profile=public|private|domain|any[,...]] [type=static|dynamic] [verbose] 备注: - 显示所有按名称指定的匹配规则, 也可按配置文件和类型指定规则。如果指定 verbose,则显示所有 匹配规则。 示例: 显示所有动态入站规则: netsh advfirewall firewall show rule name=all dir=in type=dynamic 显示名为 "allow browser" 的所有入站规则的 所有设置: netsh advfirewall firewall show rule name="allow browser" verbose
显示命令列表。
»netsh »advfirewall »help
C:\Windows>netsh advfirewall help ? 用法: help 说明: 显示命令列表。
将策略文件导入当前策略存储。
»netsh »advfirewall »import
C:\Windows>netsh advfirewall import ? 用法: import <path\filename> 注释: - 从指定文件导入策略。 示例: netsh advfirewall import "c: ewpolicy.pol"
更改到 `netsh advfirewall mainmode' 上下文。
»netsh »advfirewall »mainmode
C:\Windows>netsh advfirewall mainmode ? 下列指令有效: 此上下文中的命令: ? - 显示命令列表。 add - 添加新的主模式规则。 delete - 删除所有匹配的主模式规则。 dump - 显示一个配置脚本。 help - 显示命令列表。 set - 为现有规则的属性设置新值。 show - 显示指定的主模式规则。 若需要命令的更多帮助信息,请键入命令,接着是空格, 后面跟 ?。
添加新的主模式规则。
»netsh »advfirewall »mainmode »add
C:\Windows>netsh advfirewall mainmode add ? 下列指令有效: 此上下文中的命令: add rule - 添加新的主模式规则。
添加新的主模式规则。
»netsh »advfirewall »mainmode »add »rule
C:\Windows>netsh advfirewall mainmode add rule ? 用法: add rule name=<string> mmsecmethods=dhgroup1|dhgroup2|dhgroup14|dhgroup24|ecdhp256| ecdhp384:3des|des|aes128|aes192|aes256-md5|sha1|sha256 |sha384[,...]|default [mmforcedh=yes|no (default=no)] [mmkeylifetime=<num>min,<num>sess] [description=<string>] [enable=yes|no (default=yes)] [profile=any|current|public|private|domain[,...]] [endpoint1=any|<IPv4 address>|<IPv6 address>|<subnet> |<range>|<list>] [endpoint2=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [auth1=computerkerb|computercert|computercertecdsap256| computercertecdsap384|computerpsk|computerntlm|anonymous[,...]] [auth1psk=<string>] [auth1kerbproxyfqdn=<fully-qualified dns name>] [auth1ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1healthcert=yes|no (default=no)] [auth1ecdsap256ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap256healthcert=yes|no (default=no)] [auth1ecdsap384ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap384healthcert=yes|no (default=no)] [type=dynamic|static (default=static)] 备注: - 向防火墙策略中添加新的主模式规则。 - 规则名称应该唯一且不能为 "all"。 - 无法为 auth1 同时指定 Computerpsk 和 computerntlm 方法。 - 不建议使用 DES、MD5 和 DHGroup1。 提供这些加密算法只是为了向后兼容。 - 最小主模式 keylifetime 为 mmkeylifetime=1min。 最大主模式 mmkeylifetime= 2880min。 会话的最小数量 = 0 个会话。 最大数量 = 2,147,483,647 个会话。 - mmsecmethods 关键字默认值将策略设置为: dhgroup2-aes128-sha1,dhgroup2-3des-sha1 - Certhash 指定证书的指纹或哈希。 - Followrenewal 指定是否自动跟随证书中的可续订链接。仅适用于 证书部分(需要 certhash)。 - Certeku 指定要在证书中匹配的用逗号分隔的 EKU OID 列表。 - Certname 指ㄒヅ渲な槊频淖址?需要 certnametype)。 - Certnametype 指定要匹配的 certname 的证书字段(需要 certname)。 - Certcriteriatype 指定当选择本地证书、验证对等证书或两者都执行 时是否对证书采取操作。 示例: -添加主模式规则 netsh advfirewall mainmode add rule name="test" description="Mainmode for RATH" Mmsecmethods=dhgroup2:3des-sha256,ecdhp384:3des-sha384 auth1=computercert,computercertecdsap256 auth1ca="C=US, O=MSFT, CN=\'Microsoft North, South, East, and West Root Authority\'" auth1healthcert=no auth1ecdsap256ca="C=US, O=MSFT, CN=\'Microsoft North, South, East, and West Root Authority\'" auth1ecdsap256healthcert=yes mmkeylifetime=2min profile=domain
删除所有匹配的主模式规则。
»netsh »advfirewall »mainmode »delete
C:\Windows>netsh advfirewall mainmode delete ? 下列指令有效: 此上下文中的命令: delete rule - 删除所有匹配的主模式规则。
删除所有匹配的主模式规则。
»netsh »advfirewall »mainmode »delete »rule
C:\Windows>netsh advfirewall mainmode delete rule ? 用法: delete rule name=<string>|all [profile=any|current|public|private|domain[,...]] [type=dynamic|static (default=static)] 备注: - 删除与指定的名称匹配的 现有主模式设置。可以选择指定配置文件。 如果具有指定名称的设置不存在,则该命令失败。 - 如果指定 name=all,则从指定类型和配置文件中 删除所有规则。 如果未指定配置文件,则对所有配置文件应用删除。 示例: 删除名称为 test 的主模式规则: netsh advfirewall mainmode delete rule name="test"
显示一个配置脚本。
»netsh »advfirewall »mainmode »dump
C:\Windows>netsh advfirewall mainmode dump ? 用法: dump 说明: 创建一个包含当前配置的脚本文件。如果保存到 文件,此脚本可以用来还原更改的配置设置。
显示命令列表。
»netsh »advfirewall »mainmode »help
C:\Windows>netsh advfirewall mainmode help ? 用法: help 说明: 显示命令列表。
为现有规则的属性设置新值。
»netsh »advfirewall »mainmode »set
C:\Windows>netsh advfirewall mainmode set ? 下列指令有效: 此上下文中的命令: set rule - 为现有规则的属性设置新值。
为现有规则的属性设置新值。
»netsh »advfirewall »mainmode »set »rule
C:\Windows>netsh advfirewall mainmode set rule ? 用法: set rule name=<String> [profile=public|private|domain|any[,...]] [type=dynamic|static (default=static)] new [name=<string>] [mmsecmethods= dhgroup1|dhgroup2|dhgroup14|dhgroup24|ecdhp256| ecdhp384:3des|des|aes128|aes192|aes256-md5|sha1|sha256| sha384[,...]|default] [mmforcedh=yes|no (default=no)] [mmkeylifetime=<num>min,<num>sess] [description=<string>] [enable=yes|no] [profile=public|private|domain|any[,...]] [endpoint1=any|localsubnet|dns|dhcp|wins|defaultgateway <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [endpoint2=any|localsubnet|dns|dhcp|wins|defaultgateway| <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>] [auth1=computerkerb|computercert|computercertecdsap256| computercertecdsap384|computerpsk|computerntlm|anonymous[,...]] [auth1psk=<string>] [auth1kerbproxyfqdn=<fully-qualified dns name>] [auth1ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1healthcert=yes|no (default=no)] [auth1ecdsap256ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap256healthcert=yes|no (default=no)] [auth1ecdsap384ca="<CA Name> [certmapping:yes|no] [excludecaname:yes|no] [catype:root|intermediate (default=root)] [certhash:<Hex hash string, with no spaces or leading 0x>] [followrenewal:yes|no (default=no)] [certeku:<EKU, EKU, ...>] [certname:<CertName>] [certnametype:<SubjectAltDNS| SubjectAltEmail|SubjectCN|SubjectOU|SubjectO|SubjectDC>] [certcriteriatype:<Selection|Validation|Both (default=both)>] | ..."] [auth1ecdsap384healthcert=yes|no (default=no)] [profile= any|current|domain|private|public[,...]] 备注: -为已标识的规则设置新的参数值。如果规则不存在, 则该命令失败。若要创建规则,请使用添加命令。 -会更新规则中 new 关键字后的值。如果没有值, 或缺少关键字 new,则不进行任何更改。 -如果多个规则与条件匹配,将更新所有 匹配的规则。 -规则名称应该唯一且不能为 "all"。 -Auth1 可以是用逗号分隔的选项列表。 无法为 auth1 同时指定 Computerpsk 和 computerntlm 方法。 -不建议使用 DES、MD5 和 DHGroup1。 提供这些加密算法只是为了向后兼容。 --最小主模式 keylifetime 为 mmkeylifetime=1min。 最笾髂J?mmkeylifetime= 2880min. 会话的最小数量 = 0 个会话。 最大数量 = 2,147,483,647 个会话。 -mmsecmethods 关键字默认值将策略设置为: dhgroup2-aes128-sha1,dhgroup2-3des-sha1 -Certhash 指定证书的指纹或哈希。 -Followrenewal 指定是否自动跟随证书中的可续订链接。仅适用于 证书部分(需要 certhash)。 -Certeku 指定要在证书中匹配的用逗号分隔的 EKU OID 列表。 -Certname 指定要匹配证书名称的字符串(需要 certnametype)。 -Certnametype 指定要匹配的 certname 的证书字段(需要 certname)。 -Certcriteriatype 指定当选择本地证书、验证对等证书或两者都执行 时是否对证书采取操作。 示例: 更改名为 test 的规则的 mmescmethods、description 和 keylifetime netsh advfirewall mainmode set rule name="test" new description="Mainmode for RATH2" Mmsecmethods=dhgroup2:3des-sha256,ecdhp384:3des-sha384 auth1=computerntlm mmkeylifetime=2min profile=domain
显示指定的主模式规则。
»netsh »advfirewall »mainmode »show
C:\Windows>netsh advfirewall mainmode show ? 下列指令有效: 此上下文中的命令: show rule - 显示指定的主模式规则。
显示指定的主模式规则。
»netsh »advfirewall »mainmode »show »rule
C:\Windows>netsh advfirewall mainmode show rule ? 用法: show rule name=<string>|all [profile=all|current|public|private|domain[,...]] [type=dynamic|static (default=static)] [verbose] 备注: - 显示与指定名称匹配的现有主模式设置。 显示由名称指定的所有匹配的规则,可以选择指定 配置文件。 如果名称中指定了“all”,则将显示指定配置文件 的所有主J缴柚谩? 示例: 显示名为 test 的主模式规则: netsh advfirewall mainmode show rule name="test"
更改到 `netsh advfirewall monitor' 上下文。
»netsh »advfirewall »monitor
C:\Windows>netsh advfirewall monitor ? 下列指令有效: 此上下文中的命令: ? - 显示命令列表。 delete - 删除所有匹配的安全关联。 dump - 显示一个配置脚本。 help - 显示命令列表。 show - 显示运行时防火墙策略设置。 若需要命令的更多帮助信息,请键入命令,接着是空格, 后面跟 ?。
删除所有匹配的安全关联。
»netsh »advfirewall »monitor »delete
C:\Windows>netsh advfirewall monitor delete ? 用法: delete mmsa|qmsa [(source destination)|all] 注释: - 该命令会删除(source destination)对指定的匹配的安全关联。 - Source 和 destination 是单独的 single IPv4 或 IPv6 地址。 示例: 删除所有快速模式安全关联: netsh advfirewall monitor delete qmsa all 删除在两个指定地址间的所有主模式安全关联: netsh advfirewall monitor delete mmsa 192.168.03 192.168.0.6
显示一个配置脚本。
»netsh »advfirewall »monitor »dump
C:\Windows>netsh advfirewall monitor dump ? 用法: dump 说明: 创建一个包含当前配置的脚本文件。如果保存到 文件,此脚本可以用来还原更改的配置设置。
显示命令列表。
»netsh »advfirewall »monitor »help
C:\Windows>netsh advfirewall monitor help ? 用法: help 说明: 显示命令列表。
显示运行时防火墙策略设置。
»netsh »advfirewall »monitor »show
C:\Windows>netsh advfirewall monitor show ? 下列指令有效: 此上下文中的命令: show consec - 显示当前 consec 状态信息。 show currentprofile - 显示当前活动的配置文件。 show firewall - 显示当前防火墙状态信息。 show mainmode - 显示当前主模式状态信息。 show mmsa - 显示主模式 SA show qmsa - 显示快速模式 SA。
显示当前 consec 状态信息。
»netsh »advfirewall »monitor »show »consec
C:\Windows>netsh advfirewall monitor show consec ? 用法: show consec [rule name=<string> [profile=public|private|domain|active|any[,...]] ] [verbose] 备注: - 显示所有可用网络配置文件的连接安全配置 - [profile=] 命令使管理员能够将输出筛选到 系统上的特定配置文件或仅返回活动或 非活动配置文件的结果 - [rule] 命令允许管理员将规则输出范围限制于某些规则 名称和状态以限制输出的范围 - Verbose 命令添加对显示详细安全和 高级规则“源名称”信息 示例: 显示当前连接安全状态: netsh advfirewall monitor show consec 显示公用配置文件的当前连接安全信息: netsh advfirewall monitor show consec rule name=all profile=public
显示当前活动的配置文件。
»netsh »advfirewall »monitor »show »currentprofile
C:\Windows>netsh advfirewall monitor show currentprofile ? 用法: show currentprofile 备注: - 该命令显示与当前活动的配置文件关联的网络连接。 示例: 显示与当前活动的配置文件关联的所有网络: netsh advfirewall monitor show currentprofile
显示当前防火墙状态信息。
»netsh »advfirewall »monitor »show »firewall
C:\Windows>netsh advfirewall monitor show firewall ? 用法: show firewall [rule name=<string> [dir=in|out] [profile=public|private|domain|active|any[,...]] ] [verbose] 备注: - 显示所有可用的网络配置文件的 Windows Defender 防火墙属性。 - profile= 参数使管理员能够将输出筛选到系统上的 特定配置文件。 - Verbose 参数添加对显示详细安全和高级 规则“源名称”信息的支持。 示例: 显示当前防火墙状态: netsh advfirewall monitor show firewall 显示公用配置文件的当前出站防火墙规则: netsh advfirewall monitor show firewall rule name=all dir=out profile=public
显示当前主模式状态信息。
»netsh »advfirewall »monitor »show »mainmode
C:\Windows>netsh advfirewall monitor show mainmode ? 用法: 显示主模式 [rule name=<string> [profile=public|private|domain|active|any[,...]] ] [verbose] 备注: - 显示所有可用网络配置文件的主模式安全配置 - [profile=] 命令使管理员能够将输出筛选到系统上的特定配置文件 或仅返回活动或非活动配置文件的结果 - [rule] 命令允许管理员将嬖蚴涑龇段拗朴谀承┕嬖蛎坪妥刺? 以限制输出的范围 - Verbose 命令添加对显示详细安全和高级规则“源名称”信息的支持 示例: 显示公用配置文件的当前主模式信息: netsh advfirewall monitor show mainmode rule name=all profile=public
显示主模式 SA
»netsh »advfirewall »monitor »show »mmsa
C:\Windows>netsh advfirewall monitor show mmsa ? 用法: show mmsa [(source destination)|all] 备注: - 该命令显示安全关联或 (source destination)对筛选的安全关联。 - 源和目标都是一个 IPv4 或 IPv6 地址。 示例: 显示所有主模式 SA: netsh advfirewall monitor show mmsa 显示两个地址之间的主模式 SA: netsh advfirewall monitor show mmsa 192.168.0.3 192.168.0.4
显示快速模式 SA。
»netsh »advfirewall »monitor »show »qmsa
C:\Windows>netsh advfirewall monitor show qmsa ? 用法: show qmsa [(source destination)|all] 备注: - 该命令显示安全关联或 (source destination)对筛选的安全关联。 - 源和目标都是一个 IPv4 或 IPv6 地址。 示例: 显示所有快速模式 SA: netsh advfirewall monitor show qmsa 显示两个地址之间的快速模式 SA: netsh advfirewall monitor show qmsa 192.168.0.3 192.168.0.4
将策略重置为默认全新策略。
»netsh »advfirewall »reset
C:\Windows>netsh advfirewall reset ? 用法: reset [export <path\filename>] 注释: - 将高级安全 Windows Defender 防火墙策略还原为默认策略。 也可以将当前活动策略导出到指定文件中。 - 在组策略对象中,该命令将所有设置返回到未配置状态并且 删除所有连接安全规则和防火墙规则。 示例: 备份当前策略,并将其还原为全新策略: netsh advfirewall reset export "c:\backuppolicy.wfw"
设置每个配置文件或全局设置。
»netsh »advfirewall »set
C:\Windows>netsh advfirewall set ? 下列指令有效: 此上下文中的命令: set allprofiles - 在所有配置文件中设置属性。 set currentprofile - 在活动配置文件中设置属性。 set domainprofile - 在域配置文件中设置属性。 set global - 设置全局属性。 set privateprofile - 在专用配置文件中设置属性。 set publicprofile - 在公用配置文件中设置属性。
在所有配置文件中设置属性。
»netsh »advfirewall »set »allprofiles
C:\Windows>netsh advfirewall set allprofiles ? 用法: set allprofiles (parameter) (value) 参数: state - 配置防火墙状态。 用法: state on|off|notconfigured firewallpolicy - 配置默认入站行为和出站行为。 用法: firewallpolicy (入站行为),(出站行为) 入站行为: blockinbound - 阻止与入站规则不匹配的入站连接。 blockinboundalways - 阻止所有入站连接,即使连接与规则匹配。 allowinbound - 允许与规则不匹配的入站连接。 notconfigured - 将值返回到未配置状态。 出站行为: allowoutbound - 允许与规则不匹配的出站连接。 blockoutbound - 阻止与规则不匹配的出站连接。 notconfigured - 将值返回到未配置状态。 settings - 配置防火墙设置。 用法: settings (参数) enable|disable|notconfigured 参数: localfirewallrules - 将本地防火墙规则与组策略规则合并。 配置组策略存储时有效。 localconsecrules - 将本地连接安全规则与组策略规则合并。 配置组策略存储时有效。 inboundusernotification - 在程序侦听入站连接时通知用户。 remotemanagement - 允许远程管理 Windows 防火墙。 unicastresponsetomulticast - 控制对多播的状态单播响应。 logging - 配置日志记录设置。 用法: logging (参数) (值) 参数: allowedconnections - 记录允许连接的日志。 值: enable|disable|notconfigured droppedconnections - 记录放弃连接的日志。 值: enable|disable|notconfigured filename - 防火墙日志的名称和位置。 值: <string>|notconfigured maxfilesize - 最大日志文件大小(KB)。 值: 1 - 32767|notconfigured 注释: - 配置所有配置文件的配置文件设置。 - "notconfigured" 值仅对于组策略存储有效。 示例: 所有配置文件关闭防火墙: netsh advfirewall set allprofiles state off 设置默认行为,以在所有配置文件上 阻止入站连接和允许出站连接: netsh advfirewall set allprofiles firewallpolicy blockinbound,allowoutbound 在所有配置文件上启用远程管理: netsh advfirewall set allprofiles settings remotemanagement enable 在所有配置文件上,记录放弃连接的日志: netsh advfirewall set allprofiles logging droppedconnections enable
在活动配置文件中设置属性。
»netsh »advfirewall »set »currentprofile
C:\Windows>netsh advfirewall set currentprofile ? 用法: set currentprofile (parameter) (value) 参数: state - 配置防火墙状态。 用法: state on|off|notconfigured firewallpolicy - 配置默认入站行为和出站行为。 用法: firewallpolicy (入站行为),(出站行为) 入站行为: blockinbound - 阻止与入站规则不匹配的入站连接。 blockinboundalways - 阻止所有入站连接,即使连接与规则匹配。 allowinbound - 允许与规则不匹配的入站连接。 notconfigured - 将值返回到未配置状态。 出站行为: allowoutbound - 允许与规则不匹配的出站连接。 blockoutbound - 阻止与规则不匹配的出站连接。 notconfigured - 将值返回到未配置状态。 settings - 配置防火墙设置。 用法: settings (parameter) enable|disable|notconfigured 参数: localfirewallrules - 将本地防火墙规则与组策略规则合并。 配置组策略存储时有效。 localconsecrules - 将本地连接安全规则与组策略规则合并。 配置组策略存储时有效。 inboundusernotification - 在程序侦听入站连接时通知用户。 remotemanagement - 允许远程管理 Windows 防火墙。 unicastresponsetomulticast - 控制对多播的状态单播响应。 logging - 配置日志记录设置。 用法: logging (参数) (值) 参数: allowedconnections - 记录允许连接的日志。 值: enable|disable|notconfigured droppedconnections - 记录放弃连接的日志。 值: enable|disable|notconfigured filename - 防火墙日志的名称和位置。 值: <string>|notconfigured maxfilesize - 最大日志文件大小(KB)。 值: 1 - 32767|notconfigured 注释: - 配置当前活动的配置文件的配置文件设置。 - "notconfigured" 值仅杂谧椴呗源娲⒂行А? 示例: 在当前活动的配置文件上关闭防火墙: netsh advfirewall set currentprofile state off 设置默认行为,以在当前活动的配置文件上 阻止入站连接和允许出站连接: netsh advfirewall set currentprofile firewallpolicy blockinbound,allowoutbound 在当前活动的配置文件上启用远程管理: netsh advfirewall set currentprofile settings remotemanagement enable 在当前活动的配置文件上,记录放弃连接的日志: netsh advfirewall set currentprofile logging droppedconnections enable
在域配置文件中设置属性。
»netsh »advfirewall »set »domainprofile
C:\Windows>netsh advfirewall set domainprofile ? 用法: set domainprofile (parameter) (value) 参数: state - 配置防火墙状态。 用法: state on|off|notconfigured firewallpolicy - 配置默认入站和出站行为。 用法: firewallpolicy (入站行为),(出站行为) 入站行为: blockinbound - 阻止与入站规则不匹配的入站连接。 blockinboundalways - 阻止所有入站连接,即使连接与规则匹配。 allowinbound - 允许与规则不匹配的入站连接。 notconfigured - 将值返回到未配置的状态。 出站行为: allowoutbound - 允许与规则不匹配的出站连接。 blockoutbound - 阻止与规则不匹配的出站连接。 notconfigured - 将值返回到未配置的状态。 settings - 配置防火墙设置。 用法: settings (参数) enable|disable|notconfigured 参数: localfirewallrules - 将本地防火墙规则与组策略规则合并。 配置组策略存储时有效。 localconsecrules - 将本地连接安全规则与组策略规则合并。 配置组策略存储时有效。 inboundusernotification - 在程序侦听入站连接时通知用户。 remotemanagement - 允许远程管理 Windows 防火墙。 unicastresponsetomulticast - 控制对多播的状态单播响应。 logging - 配置日志记录设置。 用法: logging (参数) (值) 参数: allowedconnections - 记录允许连接的日志。 值: enable|disable|notconfigured droppedconnections - 记录放弃连接的日志。 值: enable|disable|notconfigured filename - 防火墙日志的名称和位置。 值: <string>|notconfigured maxfilesize - 最大日志文件大小(以 KB 计)。 值: 1 - 32767|notconfigured 注释: - 配置域配置文件设置。 - "notconfigured" 值仅对于组策略存储有效。 示例: 在域配置文件活动时关闭防火墙: netsh advfirewall set domainprofile state off 设置默认行为,以在域配置文件活动时阻止入站连接和允许出站连接: netsh advfirewall set domainprofile firewallpolicy blockinbound,allowoutbound 在域配置文件活动时启用远程管理: netsh advfirewall set domainprofile settings remotemanagement enable 在域配置文件活动时,记录放弃连接的日志: netsh advfirewall set domainprofile logging droppedconnections enable
设置全局属性。
»netsh »advfirewall »set »global
C:\Windows>netsh advfirewall set global ? 用法: set global statefulftp|statefulpptp enable|disable|notconfigured set global ipsec (parameter) (value) set global mainmode (parameter) (value) | notconfigured IPsec 参数: strongcrlcheck - 配置如何强制 CRL 检查。 0: 禁用 CRL 检查(默认值) 1: 如果证书被吊销,则失败 2: 出现任何错误,都失败 notconfigured: 将该值返回到未 配置状态。 saidletimemin - 配置安全关联空闲时间(以分钟为单位)。 - 用法: 5-60|notconfigured (default=5) defaultexemptions - 配置默认的 IPSec 免除。默认值为 将 IPv6 neighbordiscovery 协议和 DHCP 从 IPSec 免除。 - 用法: none|neighbordiscovery|icmp|dhcp|notconfigured ipsecthroughnat - 可以与网络地址转换器后面的 计算机建立安全关联时配置。 - 用法: never|serverbehindnat| serverandclientbehindnat| notconfigured(default=never) authzcomputergrp - 配置授权建立隧道模式连接的计算机。 - 用法: none|<SDDL string>|notconfigured authzusergrp - 配置授权建立隧道模式连接的用户。 tunnel mode connections. - 用法: none|<SDDL string>|notconfigured 主模式参数: mmkeylifetime - 设置主模式密钥生存时间(以分钟为单位) 或会话,或两者。 - 用法: <num>min,<num>sess minlifetime: <1> 分钟, maxlifetime: <2880> 分钟, minsessions: <0> 个会话, maxsessions: <2,147,483,647> 个会话 mmsecmethods - 配置主模式建议列表 - 用法: keyexch:enc-integrity,keyexch: enc-integrity[,...]|default - keyexch=dhgroup1|dhgroup2|dhgroup14|dhgroup24| ecdhp256|ecdhp384 - enc=3des|des|aes128|aes192|aes256 - integrity=md5|sha1|sha256|sha384 mmforcedh - 配置使用 DH 确保密钥交换安全的选项。 - 用法: yes|no (default=no) 注释: - 配置全局设置,包括高级 IPsec 选项。 - 不建议使用 DES、MD5 和 DHGroup1。提供这些 加密算法只用于向下兼容。 - mmsecmethods 关键字 default 将策略设置为: dhgroup2-aes128-sha1,dhgroup2-3des-sha1 示例: 禁用 CRL 检查: netsh advfirewall set global ipsec strongcrlcheck 0 启用防火墙对状态 FTP 的支持: netsh advfirewall set global statefulftp enable 将全局主模式建议设置为默认值: netsh advfirewall set global mainmode mmsecmethods default 将全局主模式建议设置为客户列表: netsh advfirewall set global mainmode mmsecmethods dhgroup1:des-md5,3des-sha1
在专用配置文件中设置属性。
»netsh »advfirewall »set »privateprofile
C:\Windows>netsh advfirewall set privateprofile ? 用法: set privateprofile (parameter) (value) 参数: state - 配置防火墙状态。 用法: state on|off|notconfigured firewallpolicy - 配置默认入站行为和出站行为。 用法: firewallpolicy (入站行为),(出站行为) 入站行为: blockinbound - 阻止与入站规则不匹配的入站连接。 blockinboundalways - 阻止所有入站连接,即使连接与规则匹配。 allowinbound - 允许与规则不匹配的入站连接。 notconfigured - 将值返回到未配置的状态。 出站行为: allowoutbound - 允许与规则不匹配的出站连接。 blockoutbound - 阻止与规则不匹配的出站连接。 notconfigured - 将值返回到未配置的状态。 settings - 配置防火墙设置。 用法: settings (参数) enable|disable|notconfigured 参数: localfirewallrules - 将本地防火墙规则与组策略规则合并。 配置组策略存储时有效。 localconsecrules - 将本地连接安全规则与组策略规则合并。 配置组策略存储时有效。 inboundusernotification - 在程序侦听入站连接时通知用户。 remotemanagement - 允许远程管理 Windows 防火墙。 unicastresponsetomulticast - 控制对多播的状态单播响应。 logging - 配置日志记录设置。 用法: logging (参数) (值) 参数: allowedconnections - 记录允许连接的日志。 值: enable|disable|notconfigured droppedconnections - 记录放弃连接的日志。 值: enable|disable|notconfigured filename - 防火墙日志的名称和位置。 值: <string>|notconfigured maxfilesize - 最大日志文件大小(KB)。 值: 1 - 32767|notconfigured 注释: - 配置专用配置文件设置。 - "notconfigured" 值仅对于组策略存储有效。 示例: 在专用配置文件活动时关闭防火墙: netsh advfirewall set privateprofile state off 设置默认行为,以在专用配置文件活动时 阻止入站连接和允许出站连接: netsh advfirewall set privateprofile firewallpolicy blockinbound,allowoutbound 在专用配置文件活动时启用远程管理: netsh advfirewall set privateprofile settings remotemanagement enable 在专用配置文件活动时,记录放弃连接的日志: netsh advfirewall set privateprofile logging droppedconnections enable
在公用配置文件中设置属性。
»netsh »advfirewall »set »publicprofile
C:\Windows>netsh advfirewall set publicprofile ? 用法: set publicprofile (参数) (值) 参数: state - 配置防火墙状态。 用法: state on|off|notconfigured firewallpolicy - 配置默认入站行为和出站行为。 用法: firewallpolicy (入站行为),(出站行为) 入站行为: blockinbound - 阻止与入站规则不匹配的入站连接。 blockinboundalways - 阻止所有入站连接,即使连接与规则匹配。 allowinbound - 允许与规则不匹配的入站连接。 notconfigured - 将值返回到未配置状态。 出站行为: allowoutbound - 允许与规则不匹配的出站连接。 blockoutbound - 阻止与规则不匹配的出站连接。 notconfigured - 将值返回到未配置状态。 settings - 配置防火墙设置。 用法: settings (参数) enable|disable|notconfigured 参数: localfirewallrules - 将本地防火墙规则与组策略规则合并。 配置组策略存储时有效。 localconsecrules - 将本地连接安全规则与组策略规则合并。 配置组策略存储时有效。 inboundusernotification - 在程序侦听入站连接时通知用户。 remotemanagement - 允许远程管理 Windows 防火墙。 unicastresponsetomulticast - 控制对多播的状态单播响应。 logging - 配置日志文件设置。 用法: logging (参数) (值) 参数: allowedconnections - 记录允许连接的日志。 值: enable|disable|notconfigured droppedconnections - 记录放弃连接的日志。 值: enable|disable|notconfigured filename - 防火墙日志的名称和位置。 值: <string>|notconfigured maxfilesize - 最大日志文件大小(KB)。 用法: 1 - 32767|notconfigured 注释: - 配置公用配置文件设置。 - "notconfigured" 值仅对于组策略存储有效。 示例: 在公用配置文件活动时关闭防火墙: netsh advfirewall set publicprofile state off 设置默认行为,以在公用配置文件活动时 阻止入站连接和允许出站连接: netsh advfirewall set publicprofile firewallpolicy blockinbound,allowoutbound 在公用配置文件活动时打开远程管理: netsh advfirewall set publicprofile settings remotemanagement enable 在公用配置文件活动时,记录放弃连接的日志: netsh advfirewall set publicprofile logging droppedconnections enable
显示配置文件或全局属性。
»netsh »advfirewall »show
C:\Windows>netsh advfirewall show ? 下列指令有效: 此上下文中的命令: show allprofiles - 显示所有配置文件的属性。 show currentprofile - 显示活动配置文件的属性。 show domainprofile - 显示域配置文件的属性。 show global - 显示全局属性。 show privateprofile - 显示专用配置文件的属性。 show publicprofile - 显示公用配置文件的属性。 show store - 显示当前交互式会话的策略存储。
显示所有配置文件的属性。
»netsh »advfirewall »show »allprofiles
C:\Windows>netsh advfirewall show allprofiles ? 用法: show allprofiles [parameter] 参数: state - 显示具有高级安全性的 Windows Defender 防火墙是否已启用。 firewallpolicy - 显示默认的入站和出站防火墙行为。 settings - 显示防火墙属性。 logging - 显示日志记录设置。 注释: - 显示所有配置文件的属性。如果没有指定参数, 则显示所有属性。 示例: 显示所有配置文件的防火墙状态: netsh advfirewall show allprofiles state
显示活动配置文件的属性。
»netsh »advfirewall »show »currentprofile
C:\Windows>netsh advfirewall show currentprofile ? 用法: show currentprofile [parameter] 参数: state - 显示具有高级安全性的 Windows Defender 防火墙是否已启用。 firewallpolicy - 显示默认的入站和出站防火墙行为。 settings - 显示防火墙属性。 logging - 显示日志记录设置。 注释: - 显示活动配置文件的属性。如果没有指定参数,则显示所有属性。 示例: 显示活动配置文件的防火墙状态: netsh advfirewall show currentprofile state
显示域配置文件的属性。
»netsh »advfirewall »show »domainprofile
C:\Windows>netsh advfirewall show domainprofile ? 用法: show domainprofile [parameter] 参数: state - 显示具有高级安全性的 Windows Defender 防火墙是否已启用。 firewallpolicy - 显示默认的入站和出站防火墙行为。 settings - 显示防火墙属性。 logging - 显示日志记录设置。 注释: - 显示域配置文件的属性。如果没有指定参数,则显示所有属性。 示例: 显示域配置文件的防火墙状? netsh advfirewall show privateprofile state
显示全局属性。
»netsh »advfirewall »show »global
C:\Windows>netsh advfirewall show global ? 用法: show global [property] 参数: ipsec - 显示 IPsec 特定设置。 statefulftp - 显示状态 ftp 支持。 statefulpptp - 显示状态 pptp 支持。 此值在 Windows 7 中被忽略,并且只能用于管理下层高级 安全 Windows Defender 防火墙。 mainmode - 显示主模式设置。 categories - 显示防火墙类别。 注释: - 显示全局属性设置。如果没有指定参数,则显示所有属性。 示例: 显示 IPsec 设置: netsh advfirewall show global ipsec 显示主模式设置: netsh advfirewall show global mainmode
显示专用配置文件的属性。
»netsh »advfirewall »show »privateprofile
C:\Windows>netsh advfirewall show privateprofile ? 用法: show privateprofile [parameter] 参数: state - 显示具有高级安全性的 Windows Defender 防火墙是否已启用。 firewallpolicy - 显示默认的入站和出站防火墙行为。 settings - 显示防火墙属性。 logging - 显示日志记录设置。 注释: - 显示私有配置文件的属性。如果没有指定参数,则显示所有属性。 示例: 显示私有配置文件的防火墙状态: netsh advfirewall show privateprofile state
显示公用配置文件的属性。
»netsh »advfirewall »show »publicprofile
C:\Windows>netsh advfirewall show publicprofile ? 用法: show publicprofile [parameter] 参数: state - 显示具有高级安全性的 Windows Defender 防火墙是否已启用。 firewallpolicy - 显示默认的入站和出站防火墙行为。 settings - 显示防火墙设置。 logging - 显示日志记录设置。 注释: - 显示公用配置文件的属性。如果没有指定参数,则显示所有属性。 示例: 显示公用配置文件防鹎阶刺? netsh advfirewall show publicprofile state
显示当前交互式会话的策略存储。
»netsh »advfirewall »show »store
C:\Windows>netsh advfirewall show store ? 用法: show store 注释: - 此命令显示当前策略存储。 示例: netsh advfirewall show store
- cn -/- de -/- en -