我刚刚在服务器上安装了 Windows Server 2008,我可以通过远程桌面连接,但无法 ping 通。我是否需要在防火墙上打开一个特殊端口才能 ping 通服务器?
答案1
答案2
在命令行上启用通过 Windows 防火墙的 ping 功能,如下所示:
netsh firewall set icmpsetting 8
显然,在 Windows Server 2008 R2 及更新版本中,这一点已更改为:
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request"
protocol=icmpv4:8,any dir=in action=allow
这...呃...真是有点拗口。
答案3
在 powershell 中你可以使用:
# allow-icmp.ps1
# Sets up windows firewall to allow inbound ICMP - using PowerShell
# Thomas Lee - [email protected]
#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
答案4
在管理 powershell 中运行这 2 个,它将在所有网络(公共/私有/域)上启用 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