Windows Server 2016 自发不接受连接

Windows Server 2016 自发不接受连接

我有一台生产服务器,直到昨天(2020 年 12 月 16 日)下午 4 点之前,它一直正常运行。此后,它开始拒绝传入的 TCP 连接以及尝试通过本地主机连接的连接。

服务器阻止所有这些连接:

• MySQL
• Ping(无法 ping 通或被客户端 ping 通但可以 ping 通 google 等网站)
• Tracert

有时 MySQL 连接可以接通,但 95% 的时间我都会得到一个10060 timeout error。该服务器托管一个网站和一个 API,两者仍然可以远程访问。

我尝试了以下方法:

• 关闭/打开防火墙
• 重新启动服务器
• 更新所有可用更新
• 扫描恶意软件
• 确保端口 3306 正在监听
• 从客户端 ping 服务器

我不知道为什么会发生这种情况。我相信这不是防火墙问题,但我想不出还有什么其他问题会改变。没有人登录服务器,正常的 cron 作业等不会修改任何与网络相关的内容。可能是服务器提供商的问题吗?

编辑 我启用了防火墙日志记录,它显示大量丢弃的 UDP 数据包。但是每个 TCP 连接都已收到。快速查找后发现 RDP 是通过 TCP 进行的,因此这可以解释为什么我可以通过 RDP 进入服务器。那么为什么服务器会丢弃 UDP 数据包呢?

编辑 服务器测试结果 客户端测试结果

答案1

我要切换到答案块,因为老实说,尝试在那个对话块中做任何事情都很麻烦。

如果您还没有,请在出现问题的服务器上下载并安装 PowerShell 7.1。

在 PowerShell (PWSH.EXE) 中运行以下脚本块并报告输出。

这将对你的 IP 配置进行一些测试

$All_IPConfigs = Get-NetIPConfiguration | Where-Object {$null -ne $_.IPv4Address.IPAddress}

Foreach ($IPConfig in $All_IPConfigs)
    {
    Write-Host "###################################"
    Write-Host "Testing interface $($IPConfig.InterfaceAlias)"

    Write-Host "Testing ip $($IPConfig.IPv4Address.IPAddress)"
    $Test_Self = $null
    $Test_Self = Test-Connection -ComputerName $($IPConfig.IPv4Address.IPAddress) -Ping -Count 2 -Quiet -ErrorAction SilentlyContinue
    Write-Host "[Can ping self?]: $($Test_Self)"

    Foreach ($Gateay in $($IPConfig.IPv4DefaultGateway.NextHop))
        {
        Write-Host "Testing gateway $($Gateay)"
        $Test_Gateway = $null
        $Test_Gateway = Test-Connection -ComputerName $($Gateay) -Ping -Count 2 -Quiet -ErrorAction SilentlyContinue
        Write-Host "[Can ping gateway?]: $($Test_Gateway)"
        }

    

    Foreach ($DNS_Server in $($IPConfig.DNSServer.ServerAddresses))
        {
        Write-Host "Testing DNS IP $($DNS_Server)"
        $Test_DNS_Network = $null
        $Test_DNS_Network = Test-NetConnection -ComputerName $DNS_Server -Port 53 -ErrorAction SilentlyContinue
        
        $Test_Resolove_Self = $null
        $Test_Resolove_Self = Resolve-DnsName -Name "$($env:computername)" -Server $DNS_Server -Type A -ErrorAction SilentlyContinue | Select-Object -First 1

        $Test_Resolove_GMail = $null
        $Test_Resolove_GMail = Resolve-DnsName -Name "gmail.com" -Server $DNS_Server -Type A -ErrorAction SilentlyContinue | Select-Object -First 1

        Write-Host "[Can ping DNS server?]: $($Test_DNS_Network.PingSucceeded)"
        Write-Host "[Can connect to DNS server TCP port 53?]: $($Test_DNS_Network.TcpTestSucceeded)"
        Write-Host "[Can resolve self?]: $($Test_Resolove_Self.IPAddress)"
        Write-Host "[Can resolve gmail?]: $($Test_Resolove_GMail.IPAddress)"
        }

    Write-Host "Testing Google DNS IP 8.8.8.8"
    $Test_Google_DNS = $null
    $Test_Google_DNS = Resolve-DnsName -Name "gmail.com" -Server "8.8.8.8" -Type A -ErrorAction SilentlyContinue | Select-Object -First 1
    Write-Host "[Can resolve gmail via Google DNS?]: $($Test_Google_DNS.IPAddress)"
    }

IP配置

Get-NetIPConfiguration   

所有网络 TCP 连接

Get-NetTCPConnection

所有网络 TCP 连接

Get-NetTCPConnection

此外,请在无法连接的客户端上运行相同的测试(所有 tcp 连接除外)。

相关内容