Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> 關於 Windows

Win7 如何開啟 Ping 回應(解除防火牆封鎖 ICMPv4)?虛擬機網路互通實測

編輯:關於 Windows

Win7 預設防火牆規則封鎖入站 ICMPv4 回應請求,導致本機可 Ping 通虛擬機,但虛擬機無法 Ping 通本機。透過「高階安全性 Windows 防火牆」啟用「檔案和印表機共用 (回應要求 - ICMPv4-In)」規則即可雙向互通。

問題重現與診斷

  1. 宿主機 IP:ipconfig → 192.168.0.111
  2. 虛擬機 IP:ifconfig → 192.168.0.101
  3. 宿主機 Ping 虛擬機:通
  4. 虛擬機 Ping 宿主機:不通(封包無回應)
  5. 虛擬機 Ping 閘道:通 → 排除虛擬機網路設定問題,鎖定宿主機防火牆攔截 ICMP 回應。

修復步驟

  1. 控制台 → 「系統與安全性」 → 「Windows 防火牆」 → 左側 「進階設定」。
  2. 左側樹狀選單選 「輸入規則」。
  3. 右側清單搜尋/篩選:「檔案和印表機共用 (回應要求 - ICMPv4-In)」(共有兩條:網域/私人/公用設定檔各一)。
  4. 各右鍵 → 「啟用規則」(圖示變綠燈)。

驗證與補充

  1. 虛擬機再次 Ping 宿主機 IP → 通,雙向互通恢復正常。

  • 安全性考量: 啟用 ICMP 回應會暴露主機存活狀態,公網環境建議僅啟用「網域/私人」設定檔規則,保持「公用」設定檔停用。
  • 命令列快速啟用: 管理員 PowerShell 執行:
    netsh advfirewall firewall set rule name="檔案和印表機共用 (回應要求 - ICMPv4-In)" new enable=yes
  • Linux 指令差異: 查看 IP 用 ifconfig 或 ip a,非 Windows 的 ipconfig。
Copyright © Windows教程網 All Rights Reserved