新增輸出規則-封鎖指定遠端IP的445port
netsh advfirewall firewall add rule name="Block445" dir=out action=block protocol=TCP remoteport=445 remoteip=192.168.30.25,192.168.100.7,192.168.100.64
pause
---------------------------------------------------
刪除名稱為Block445的規則
netsh advfirewall firewall delete rule name="Block445"
pause
---------------------------------------------------
新增輸入規則-封鎖139port
netsh advfirewall firewall add rule name="Block TCP 139" protocol=TCP dir=in localport=1395 action=block
pause
---------------------------------------------------
刪除名稱為Block139的規則
netsh advfirewall firewall delete rule name="Block TCP 139"
pause
---------------------------------------------------
新增-防火牆遠端桌面限制只能102網段連入
netsh advfirewall firewall set rule name="遠端桌面 - 使用者模式 (TCP-In)" new remoteip=192.168.102.0/24
netsh advfirewall firewall set rule name="遠端桌面 - 使用者模式 (UDP-In)" new remoteip=192.168.102.0/24
netsh advfirewall firewall set rule name="遠端桌面 - 陰影 (TCP-In)" new remoteip=192.168.102.0/24
pause
---------------------------------------------------
刪除-防火牆遠端桌面限制只能102網段連入
netsh advfirewall firewall set rule name="遠端桌面 - 使用者模式 (TCP-In)" new remoteip=any
netsh advfirewall firewall set rule name="遠端桌面 - 使用者模式 (UDP-In)" new remoteip=any
netsh advfirewall firewall set rule name="遠端桌面 - 陰影 (TCP-In)" new remoteip=any
pause
留言列表