firewall记录

1 windows:

rem 只针对win2003以上系统


rem 关闭135、445端口:
sc config srv start= disabled   
sc config netbt start= disabled
 
net start mpssvc
sc config mpssvc start= auto
netsh advfirewall set allprofile state on
netsh advfirewall firewall add rule name=TCP135 dir=in action=block protocol=TCP localport=135
netsh advfirewall firewall add rule name=UDP135 dir=in action=block protocol=UDP localport=135
netsh advfirewall firewall add rule name=TCP137 dir=in action=block protocol=TCP localport=137
netsh advfirewall firewall add rule name=UDP137 dir=in action=block protocol=UDP localport=137
netsh advfirewall firewall add rule name=TCP139 dir=in action=block protocol=TCP localport=139
netsh advfirewall firewall add rule name=UDP139 dir=in action=block protocol=UDP localport=139
netsh advfirewall firewall add rule name=TCP445 dir=in action=block protocol=TCP localport=445
netsh advfirewall firewall add rule name=UDP445 dir=in action=block protocol=UDP localport=445

 

2008:

netsh advfirewall set allprofile state on
netsh advfirewall reset
netsh advfirewall set allprofiles firewallpolicy blockinbound,blockoutbound
netsh advfirewall firewall add rule name="135,445" dir=in action=block protocol=TCP localport=135,445
netsh advfirewall firewall add rule name="dahua" dir=in action=allow remoteip=192.168.0.0/24,172.16.0.0/16 protocol=TCP localport=21,80,8081,8090,9000,9001,9100,9115,9200,9320,9400,9500,9600,9700,9800,12366
netsh advfirewall firewall add rule name="oracle" dir=in action=allow remoteip=192.168.1.0/255.255.255.0 protocol=TCP localport=1521
netsh advfirewall firewall add rule name="dahuaAPP" dir=in action=allow  remoteip=192.168.0.0/24,172.16.0.0/16 program="C:\MyApp\MyApp.exe" enable=yes

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

rem action=allow action=block
rem netsh firewall add port tcp 139 netbios-ssn enable custom 192.168.0.0/255.255.0.0,10.0.0.0/255.0.0.0




rem ========
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值