Old command 针对win7以下版本<包含win7>

Example 1: 启用一个程序

Old command

New command

netsh firewall add allowedprogram C:\MyApp\MyApp.exe "My Application" ENABLE

netsh advfirewall firewall add rule name=”My Application” dir=in action=allow program=”C:\MyApp\MyApp.exe” enable=yes

netsh firewall add allowedprogram program=C:\MyApp\MyApp.exe name="My Application" mode=ENABLE scope=CUSTOM addresses=157.60.0.1,172.16.0.0/16,LocalSubnet profile=Domain

netsh advfirewall firewall add rule name=”My Application” dir=in action=allow program=”C:\MyApp\MyApp.exe” enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain

netsh firewall add allowedprogram program=C:\MyApp\MyApp.exe name="My Application" mode=ENABLE scope=CUSTOM addresses=157.60.0.1,172.16.0.0/16,LocalSubnet profile=ALL

Run the following commands:

netsh advfirewall firewall add rule name=”My Application” dir=in action=allow program=”C:\MyApp\MyApp.exe” enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain

netsh advfirewall firewall add rule name=”My Application” dir=in action=allow program=”C:\MyApp\MyApp.exe” enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=private

Example 2: 启用端口

Old command

New command

netsh firewall add portopening TCP 80 “Open Port 80”

netsh advfirewall firewall add rule name=”Open Port 80” dir=in action=allow protocol=TCP localport=80

Example 3: 删除已启用的程序或端口

Old command

New command

netsh firewall delete allowedprogram C:\MyApp\MyApp.exe

netsh advfirewall firewall delete rule name=rule nameprogram=”C:\MyApp\MyApp.exe”

delete portopening protocol=UDP port=500

netsh advfirewall firewall delete rule name=rule nameprotocol=udp localport=500

Example 4: ICMP配置

Old command

New command

netsh firewall set icmpsetting 8

netsh advfirewall firewall add rule name=”ICMP Allow incoming V4 echo request” protocol=icmpv4:8,any dir=in action=allow

netsh firewall set icmpsetting type=ALL mode=enable

netsh advfirewall firewall add rule name=”All ICMP V4” protocol=icmpv4:any,any dir=in action=allow

Example 5: 设置日志

Old command

New command

netsh firewall set logging %systemroot%\system32\LogFiles\Firewall\pfirewall.log 4096 ENABLE ENABLE

Run the following commands:

netsh advfirewall set currentprofile logging filename %systemroot%\system32\LogFiles\Firewall\pfirewall.log

netsh advfirewall set currentprofile logging maxfilesize 4096
netsh advfirewall set currentprofile logging droppedconnections enable

netsh advfirewall set currentprofile logging allowedconnections enable

Example 6:启动防火墙

Old command

New command

netsh firewall set opmode ENABLE

netsh advfirewall set currentprofile state on

netsh firewall set opmode mode=ENABLE exceptions=enable

Run the following commands:

Netsh advfirewall set currentprofile state on

netsh advfirewall set currentprofile firewallpolicy blockinboundalways,allowoutbound

netsh firewall set opmode mode=enable exceptions=disable profile=domain

Run the following commands:

Netsh advfirewall set domainprofile state on

netsh advfirewall set domainprofile firewallpolicy blockinbound,allowoutbound

netsh firewall set opmode mode=enable profile =ALL

Run the following commands:

netsh advfirewall set domainprofile state on

netsh advfirewall set privateprofile state on

For more information, run the following command:

netsh advfirewall set currentprofile ?

Example 7: 恢复默认防火墙策略

Old command

New command

netsh firewall reset

netsh advfirewall reset

查看更多的信息,运行以下命令

netsh advfirewall reset ?

Example 8: 启用特定的服务

Old command

New command

netsh firewall set service FileAndPrint

netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=Yes

netsh firewall set service RemoteDesktop enable

netsh advfirewall firewall set rule group="remote desktop" new enable=Yes

netsh firewall set service RemoteDesktop enable profile=ALL

Run the following commands:

netsh advfirewall firewall set rule group="remote desktop " new enable=Yes profile=domain

netsh advfirewall firewall set rule group="remote desktop " new enable=Yes profile=private

windows防火墙命令详解的更多相关文章

  1. windows curl命令详解

    概述 Curl命令可以通过命令行的方式,执行Http请求.在Elasticsearch中有使用的场景,因此这里研究下如何在windows下执行curl命令. 软件下载 下载地址:https://cur ...

  2. windows 终端命令详解

    打开"运行"对话框(Win+R),输入cmd,打开控制台命令窗口... 也可以通过cmd /c 命令 和 cmd /k 命令的方式来直接运行命令 注:/c表示执行完命令后关闭cmd ...

  3. centos7中firewall防火墙命令详解

    为了架设ss在vultr上买了一个日本的vps 用的是centos7的系统 防火墙是 firewall 捣鼓了两天 在这里总结一下. 如果小伙伴也准备在vultr上买vps  在注册是 可以使用这个优 ...

  4. firewall-cmd 防火墙命令详解 及 TCP Wrappers

    firewall-cmd 常用参数及作用 参数 作用 --get-default-zone 查询默认的区域名称 --set-default-zone=<区域名称> 设置默认的区域,使其永久 ...

  5. WINDOWS FTP命令详解

    FTP命令是Internet用户使用最频繁的命令之一,不论是在DOS还是UNIX操作系统下使用FTP,都会遇到大量的FTP内部命令.熟悉并灵活应用FTP的内部命令,可以大大方便使用者,并收到事半功倍之 ...

  6. Linux防火墙iptables学习笔记(三)iptables命令详解和举例[转载]

     Linux防火墙iptables学习笔记(三)iptables命令详解和举例 2008-10-16 23:45:46 转载 网上看到这个配置讲解得还比较易懂,就转过来了,大家一起看下,希望对您工作能 ...

  7. windows/NBTSTAT,linux/nmblookup命令详解,查询NetBIOS名

    NBTSTAT命令详解 请问: Linux下有没有和nbtstat一样的命令,用 nmblookup -A ip 可以 nbstat命令主要用于查看当前基于netbios的tcp/ip连接状态,通过该 ...

  8. scp命令详解

    \ svn 删除所有的 .svn文件 find . -name .svn -type d -exec rm -fr {} \; linux之cp/scp命令+scp命令详解   名称:cp 使用权限: ...

  9. net user命令详解

    net use \\ip\ipc$ " " /user:" " 建立IPC空链接 net use \\ip\ipc$ "密码" /user: ...

随机推荐

  1. sdk 更新的时连接不上dl-ssl.google.com解决办法

    今天有朋友说sdk的更新不了,借了个VPN给他也没解决问题,后来还是他自己解决了,下面分享下经验 这里介绍一种不需要FQ的解决办法,修改C:\Windows\System32\drivers\etc下 ...

  2. Sql Server批量删除指定表

    --批量删除以test的表开头的表 declare @name varchar(50) while(exists(select * from sysobjects where name like te ...

  3. maven记录

    1. 跳过测试 mvn  -Dmaven.test.skip=true 2. 依赖树 mvn dependency:tree 3. 生成UTF-8的eclipse工程 构成目录中的.settings文 ...

  4. 我的AngularJS 学习之旅(二)

    记得某位大神说过,"时间就像海绵里的水,挤挤总是有的.".大多时候,与其说我是很忙而没时间去做自己想做的事, 倒不如说是懒得去做罢了. 废话不多说,接前一篇继续吧 3.3 指令(D ...

  5. C# TreeView的CheckBox 父/子节点点击联动选择效果

    注: 点击时请正常速度点击,不然会出现“奇怪”现象!!! /// <summary> /// 节点点击 子级->同级->父级 /// </summary> /// ...

  6. [原创]java WEB学习笔记96:Spring学习---Spring简介及HelloWord

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  7. 解决Ruby在IE11中报Unable to get browser (Selenium::WebDriver::Error::NoSuchWindowError)的错误

    转载地址:http://www.tuicool.com/articles/BRnqeu2 I was updating the browser WebDrivers for    Seleno    ...

  8. jquery-mobile的页面跳转和iscroll之间的兼容解决方法

    有一项目需要用到滚动效果,最后选择了iscroll插件,代码写好后chrome测试一切正常(直接查看用到滚动效果的页面以下统称当前页面),运行APP应用一步步跳转到当前页面的时候,滚动效果和滚动条等死 ...

  9. ubuntu 如何 su 到 root(作为 root 用户操作)

    ubuntu 安装后,root用户默认被锁定,不允许登录,也不允许"su"到 root.对于桌面用户来说,这样安全性更高一些,但对于服务器可以设置成"允许 su 到roo ...

  10. 虚拟主机无法使用fsockopen操作处理方法

    一.如何禁用fsockopen()下面是两种常用的禁用fsockopen的方法.1.修改php.ini,将 disable_functions = 后加入 fsockopen2.修改php.ini,将 ...