
我有一台生產伺服器,名義上一直工作到昨天(2020 年 12 月 16 日)下午 4 點。此後,它開始拒絕傳入的 TCP 連線以及嘗試透過 localhost 連線的連線。
伺服器阻止所有這些連接:
• MySQL
• Ping(無法 ping 或被客戶端 ping 到,但可以 ping 到 google 等網站)
• Tracert
有時 MySQL 連線會通過,但 95% 的情況下我會得到一個10060 timeout error
.該伺服器託管一個網站和一個 API,兩者仍然可以遠端存取。
我嘗試過以下方法:
• 關閉/開啟防火牆
• 重新啟動伺服器
• 更新所有可用更新
• 掃描惡意軟體
• 確保連接埠 3306 正在偵聽
• 從用戶端對伺服器執行 Ping 操作
我不知道為什麼會這樣。我相信這不是防火牆問題,但我想不出還有什麼可以改變的。沒有人登入伺服器,正常的 cron 作業等不會修改任何與網路相關的內容。可能是伺服器提供者嗎?
編輯 我已啟用防火牆日誌記錄,它顯示大量丟棄的 UDP 封包。然而,每個 TCP 連線都會被接收。快速尋找 RDP 是透過 TCP 傳輸的,這樣就可以解釋為什麼我可以透過 RDP 連線到伺服器。那為什麼伺服器會丟棄 UDP 封包呢?
答案1
我要切換到答案區塊,因為誠實地嘗試在該對話區塊中做任何事情都是 PITA。
如果您還沒有,請在遇到問題的伺服器上下載並安裝 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 連線除外)。