在 Windows Server 防火墙中启用 Ping?

hol*_*ira 25 windows monitoring windows-server-2008 firewall ping

我刚刚在服务器上安装了 Windows Server 2008,我能够通过远程桌面连接但无法 ping。我是否需要在防火墙上打开一个特殊端口才能 ping 服务器?

sh-*_*eta 34

默认情况下,Windows 2008 不响应 ping。启用:

管理工具

具有高级安全性的 Windows 防火墙

入境规则

文件和打印机共享(回显请求 - ICMPv4-IN)

启用规则

您现在应该能够从 LAN ping 您的服务器。

  • IPv6呢?不会有人考虑IPv6!?! (4认同)

Jef*_*ood 12

在命令行中通过 Windows 防火墙启用 ping,如下所示:

netsh firewall set icmpsetting 8
Run Code Online (Sandbox Code Playgroud)

显然,这在 Windows Server 2008 R2 和更新版本中已更改为:

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request"
    protocol=icmpv4:8,any dir=in action=allow
Run Code Online (Sandbox Code Playgroud)

那是......呃......相当一口。


Alb*_*ban 9

在 powershell 中,您可以使用:

# allow-icmp.ps1
# Sets up windows firewall to allow inbound ICMP - using PowerShell
# Thomas Lee - tfl@psp.co.uk

#create firewall manager object
$FWM=new-object -com hnetcfg.fwmgr

# Get current profile
$pro=$fwm.LocalPolicy.CurrentProfile

# Check Profile
if ($pro.IcmpSettings.AllowInboundEchoRequest) {
    "Echo Request already allowed"
} else {
    $pro.icmpsettings.AllowInboundEchoRequest=$true
}

# Display ICMP Settings
"Windows Firewall - current ICMP Settings:"
"-----------------------------------------"
$pro.icmpsettings
Run Code Online (Sandbox Code Playgroud)


Jus*_*ott 8

您将希望允许 ICMP 数据包通过。Ping 不使用 TCP,因此没有要打开的端口。

  • “ping 不使用 TCP”这一事实有点误导。由于还有其他使用端口的协议,因此说“ping 使用 ICMP,这是一种无端口的第 3 层协议,因此您启用 ICMP 以允许 ping,而不是打开端口”可能更有用。某些防火墙允许您过滤消息类型,因此您需要允许“回显请求”和“回显响应”以允许 ping 工作。 (7认同)

CMC*_*kai 5

在 admin powershell 中运行这两个命令,它会在所有网络(公共/私有/域)上启用 ipv6 和 ipv4 入站 ping:

Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -enabled True
Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv6-In)" -enabled True
Run Code Online (Sandbox Code Playgroud)

它相当于这个https://serverfault.com/a/6049/147813