2008年7月30日星期三

教你命令行下配置Windows XP作業系統防火牆

命令:netsh firewall

參數:
? // 顯示命令列表
add             // 添加防火牆配置
delete            // 刪除防火牆配置
dump             // 顯示一個配置腳本
help               // 顯示命令列表
reset              // 將防火牆配置重置為預設值。
set              // 設置防火牆配置
show              // 顯示防火牆配置
add allowedprogram        // 添加防火牆允許的程式配置。
add portopening         // 添加防火牆埠配置
delete allowedprogram      // 刪除防火牆允許的程式配置
delete portopening         // 刪除防火牆埠配置
set allowedprogram       // 設置防火牆允許的程式配置
set icmpsetting         // 設置防火牆 ICMP 配置
set logging            // 設置防火牆記錄配置
set multicastbroadcastresponse   // 設置防火牆多播/廣播回應配置
set notifications         // 設置防火牆通知配置
set opmode           // 設置防火牆操作配置
set portopening         // 設置防火牆埠配置
set service             // 設置防火牆服務配置
show allowedprogram       // 顯示防火牆允許的程式配置
show config           // 顯示防火牆配置。
show currentprofile         // 顯示當前防火牆配置檔
show icmpsetting         // 顯示防火牆 ICMP 配置
show logging            // 顯示防火牆記錄配置
show multicastbroadcastresponse  // 顯示防火牆多播/廣播回應配置
show notifications        // 顯示防火牆操作配置
show opmode          // 顯示防火牆埠配置
show portopening        // 顯示防火牆埠配置
show service          // 顯示防火牆服務配置
show state           // 顯示當前防火牆狀態

例如:

命令:
netsh firewall show allowedprogram           //查看防火牆放行的程式
netsh firewall set portopening TCP 445 ENABLE     //打開445埠
netsh firewall set portopening TCP 3389 ENABLE      //不用說了,放行終端啦。
netsh firewall delete allowedprogram C:\A.exe       //刪除放行程式A.exe
netsh firewall set allowedprogram C:\A.exe A ENABLE    //添加程式C盤下的A.exe並放行
netsh firewall add allowedprogram C:\A.exe A ENABLE  //添加程式C盤下的A.exe並放行 

set allowedprogram和add allowedprogram效果一樣都可以添加放行程式,C:\A.exe是程式路徑A是在防火牆裏顯示的程式名字,這個名字可以 隨便寫,別有用心的傢伙可以用個迷惑性的名字。。呵呵。。其他命令自己試試吧。

要是終端登陸做了IP限制的可以用netsh firewall set portopening TCP 3389 遠端桌面 ENABLE CUSTOM 1.1.1.1<---你的IP,這個命令(中文版XP2)。

沒有留言:

發佈留言