1. 程式人生 > >windows防火牆命令詳解(程式啟用命令列執行即可)

windows防火牆命令詳解(程式啟用命令列執行即可)

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: 啟用一個程

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

Example 2: 啟用埠

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

Example 3: 刪除已啟用的程式或埠

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

Example 4: ICMP配置

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

Example 5: 設定日誌

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

Example 6:啟動防火牆

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

For more information, run the following command:

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

相關推薦

windows防火牆命令程式啟用命令執行即可

netsh firewall set portopening protocol = TCP port = 9998 name = ssssssssssssssssssssssss mode = ENABLE scope = SUBNET profile = CURRENT

RPM命令安裝、解除安裝、升級

零、rpm 常用命令 1.安裝一個包 # rpm -ivh 2.升級一個包 # rpm -Uvh 3.解除安裝一個包 # rpm -e 首先通過  rpm -q <關鍵字> 可以查詢到rpm包的名字,    然後 呼叫 rpm -e <包的名字

RPM命令安裝、升級、解除安裝

rpm 常用命令 1.安裝一個包  # rpm -ivh  2.升級一個包  # rpm -Uvh  3.解除安裝一個包  # rpm -e  4.安裝引數  --force 即使覆蓋屬於其它包的檔案也強迫安裝  --nodeps 如果該RPM包的安裝依賴其它包,即使其它包沒裝,也強迫安裝。  5.查詢一個包

Netstat命令windows

3.6 包含 baidu ack sin foreign 流行 ogl windows 轉自:http://blog.csdn.net/hsd2012/article/details/50759017 Netstat 用於顯示與IP 、TCP 、UDP 和ICMP 協議

Linux 命令Shell腳本的數組

cti err art case lin start shell pre round 1、數組定義 [[email protected] ~]# a=(1 2 3 4 5 6 7 8) [[email protected]-IDC ~]# echo $

Linux命令部分昨今兩天

Linux命令詳解基本命令1.Linux的基本原則:1、由目的單一的小程序組成;組合小程序完成復雜任務;2、一切皆文件;3、盡量避免捕獲用戶接口;(盡量不和用戶進行交互,就是一個程序一但開始運行,就不需要用戶進行任何操作,如ls命令,ifconfig命令)4、配置文件保存為純文本格式;2.命令形式命令格式:命

網工最實用最常用的網絡命令之一——Ping 命令

關閉 連通 自己 命令詳解 機房 幫助 辦公室 技術分享 詳解 Ping是Windows、Unix和Linux系統下的一個命令。ping也屬於一個通信協議,是TCP/IP協議的一部分。利用“ping”命令可以檢查網絡是否連通,可以很好地幫助我們分析和判定網絡故障。 網工最實

Linux 文本對比 diff 命令整理

targe def -h 改變 windows 全部 的人 方便 匹配 diff 命令詳解 1.概述 windows系統下面就有不錯的文本對比工具可以使用,例如常用的Beyond Compare,WinMerge都是圖形界面的比較工具而且使用非常方便,如果你僅僅是在

MYSQL-EXPLAIN 命令 轉載

test cacheable sel exp 打開慢 一起 select語句 方式 命令詳解 在工作中,我們用於捕捉性能問題最常用的就是打開慢查詢,定位執行效率差的SQL,那麽當我們定位到一個SQL以後還不算完事,我們還需要知道該SQL的執行計劃,比如是全表掃描,還是索引掃

Linux下的tar壓縮壓縮命令

壓縮歸檔 增加 all log 參數 -c 內容 net logo tar -c: 建立壓縮檔案-x:解壓-t:查看內容-r:向壓縮歸檔文件末尾追加文件-u:更新原壓縮包中的文件 這五個是獨立的命令,壓縮解壓都要用到其中一個,可以和別的命令連用但只能用其中一個。下面的參數是

linux 命令同步更新

inf 當前 目錄結構 技術 code whereis tail linux 正在 linux 目錄結構 常用快捷鍵 Ctrl+C 中斷正在執行的程序 Ctrl+Z 掛起正在執行的程序 Ctrl+D 退出當前的Shell,該快捷鍵的功能相當於exit 基本操作命令

awk命令

第一篇的連結:Linux awk命令總結(一) 1. 處理陣列 為了在單個變數中儲存多個值,許多程式語言都提供了陣列,在awk中使用關聯陣列提供陣列的功能。 關聯陣列類似於散列表和字典,索引值可以是任意的文字字串,對索引的唯一要求是每個索引字串都能夠唯一的對應賦值給它的資料元素。 (

crontab 命令筆記

# crontab 詳解https://www.cnblogs.com/intval/p/5763929.html */1 * * * * /bin/sh /server/scripts/echo.sh  前面一共有5 個* 號,每個*號各表示不同的意思 第一位代表 分鐘

IntelliJ IDEA安裝使用啟用啟用

  第一步:進入官網下載IntelliJ IDEA https://www.jetbrains.com/idea/download/#section=windows,選擇適合版本下載;   第二步:雙擊已下載檔案,進行開始安裝; 點選&nbs

linux檢視程序命令ps命令

  Linux中的ps命令是Process Status的縮寫。ps命令用來列出系統中當前執行的那些程序。ps命令列出的是當前那些程序的快照,就是執行ps命令的那個時刻的那些程序,如果想要動態的顯示程序資訊,就可以使用top命令。要對程序進行監測和控制,首先必須要了解當前

linux free命令

一. 作用     free命令可以顯示當前系統未使用的和已使用的記憶體數目,還可以顯示被核心使用的記憶體緩衝區。 二. 語法  free [選項] 三. 選項       預設情況下,即在沒有選項的情況下,"free"命令顯示記憶體的使用資訊。預設

tmux使用程式後臺遠端主機,斷電不斷線

    首先要開一個專有的session tmux new-session -s 後臺程序名字 切換到tmux不同視窗 ctrl + B,然後按c 退出到主介面 tmux det 列出現在存在的tmux程序 tmux list-sessions

Git 常用命令

      一、 Git 命令初識 在正式介紹Git命令之前,先介紹一下Git 的基本命令和操作,對Git命令有一個總體的認識 示例:從Git 版本庫的初始化,通常有兩種方式: 1)git clone:這是一種較為簡單的初始化方式,當你已經

Vim命令----.重複上次修改命令

對於命令重複操作命令 (.),英文下的句號。 這個命令可以重複上次執行的修改命令,要記住一定是修改命令,如游標移動或者查詢命令不會重複執行。 例如:刪除命令x,在命令模式下執行刪除x後,可在命令模式下點選(.)命令進行重複刪除。 後續補充。。。

OpenSSL 命令——摘要演算法、簽名、驗籤

鋒影 email:[email protected] 如果你認為本系列文章對你有所幫助,請大家有錢的捧個錢場,點選此處贊助,贊助額0.1元起步,多少隨意 用什麼摘要演算法指令代替時,預設使用該演算法,但也可以指定其他演算法。 使用指令