繁体   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