Quantcast
Channel: 簡睿隨筆
Viewing all articles
Browse latest Browse all 897

快速建立Windows Defender Firewall 封鎖IP的Command Line命令

$
0
0

1. 建立與設定規則

要透過Windows Defender Firewall 來封鎖多個IP時,使用視窗的方式操作步驟頗多,可改用下列命令,能飛快的建立好相關規則。

  1. 建立封鎖IP的規則

    netsh advfirewall firewall add rule name="Blacklist" dir=in action=block remoteip=w1.x1.y1.z1
  2. 添加新的IP,必須使用完整的IP清單

    netsh advfirewall firewall set rule name="Blacklist" new dir=in action=block remoteip=w1.x1.y1.z1,w2.x2.y2.z2
  3. 現有的remoteip可以用show查詢顯示

    netsh advfirewall firewall show rule name=Blacklist

2. 設定輸出log

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

##

您可能也會有興趣的類似文章


Viewing all articles
Browse latest Browse all 897

Trending Articles