簡體   English   中英

無法在命令行/ PowerShell Windows 7中對任何站點執行ping操作

[英]unable to ping any sites in command line/powershell windows 7

Windows命令行是否需要對ping網站進行任何代理設置?

我可以在瀏覽器中訪問所有網站,但是當我嘗試從命令行或Powershell ping通相同的網站時,出現“請求超時”錯誤。 如何解決這個錯誤?

在IE瀏覽器中,我設置了自動代理檢測腳本,因為網絡是公司LAN。 嘗試了Web中提供的大多數解決方案,沒有任何運氣。

因此,我無法運行Chef命令來安裝gems並接收到錯誤Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respon d after a period of time, or established connection failed because connected hos t has failed to respond. - connect(2) for "api.rubygems.org" port 443 (https://a pi.rubygems.org/specs.4.8.gz) Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: A connection attempt failed because the connected party did not properly respon d after a period of time, or established connection failed because connected hos t has failed to respond. - connect(2) for "api.rubygems.org" port 443 (https://a pi.rubygems.org/specs.4.8.gz)

獲得ping回復或HTTP響應是兩件完全不同的事情。 也就是說,任何服務器都可以盡其所能地兌現任何一個。 此外,路由上可能還存在代理和防火牆,它們會改變結果。 即使服務器願意通過ping回復,公司防火牆也可能阻止它。

根據文檔 ,通過環境變量設置Chef的代理設置可能會成功。 關於如何查找代理設置,請咨詢您的網絡管理員。 如果這樣不起作用,請從IE的注冊表項中檢索代理設置。 萬一鏈接腐爛,這是函數:

function Get-InternetProxy { 
    <# 
            .SYNOPSIS 
                Determine the internet proxy address
            .DESCRIPTION
                This function allows you to determine the the internet proxy address used by your computer
            .EXAMPLE 
                Get-InternetProxy
            .Notes 
                Author : Antoine DELRUE 
                WebSite: http://obilan.be 
    #> 

    $proxies = (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyServer

    if ($proxies) {
        if ($proxies -ilike "*=*") {
            $proxies -replace "=","://" -split(';') | Select-Object -First 1
        } else {
            "http://" + $proxies
        }
    }    
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM