windows防火墙命令详解(程序启用命令行执行即可)
2016-01-25 14:12
190 查看
netsh firewall set portopening protocol = TCP port = 9998 name = ssssssssssssssssssssssss mode = ENABLE scope = SUBNET profile = CURRENT netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN
Old command 针对win7以下版本<包含win7>
Example 1: 启用一个程[b]序[/b]
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 |
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 |
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 name protocol=udp localport=500 |
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 |
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 |
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 |
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 |
相关文章推荐
- Fiddler抓取手机APP数据包
- Spark入门实战系列--2.Spark编译与部署(上)--基础环境搭建
- 用PL/SQL Developer直接COPY SQL语句变成StringBuffer语句[转]
- Handler,Looper消息传递机制
- python多线程与多进程 超简单使用
- 第五篇 UICollectionView
- 汇编题目:在DOS下,按F1键后改变当前屏幕的显示颜色
- 什么是词干化处理
- Java的数据类型
- swfupload
- 【Echarts】数据可视化_前端页面实现尝试
- perl 实现微信登录 获取好友 群信息的简单实现
- 支付宝PM告诉你,互联网产品经理的工作职责有哪些?
- Java开发中的23种设计模式详解
- 《探索式软件测试》中提到的几种需要测试的情况
- 基于BootStrap框架构建快速响应的GPS部标监控平台
- shell脚本案例
- 入门句法分析
- 数据库连接driverClass和jdbcUrl大全
- 信必优荣幸成为Rightware公司Kanzi合作伙伴计划创始成员