无法解析主机名,ping 有效 [英] Could not resolve hostname, ping works
问题描述
我已经安装了 RasPi Raspbian,但现在我无法执行 ssh 或 git clone,似乎只能解析本地主机名.然而 ping 工作:
I have installed RasPi Raspbian, and now I can't do ssh or git clone, only local host names are being resolved it seems. And yet ping works:
pi ~ $ ssh test.com
ssh: Could not resolve hostname test.com: Name or service not known
pi ~ $ git clone gitosis@test.com:test.git
Cloning into 'test'...
ssh: Could not resolve hostname test.com: Name or service not known
fatal: The remote end hung up unexpectedly
pi ~ $ ping test.com
PING test.com (174.36.85.72) 56(84) bytes of data.
我通过使用 http://github.com
而不是 git://github.com
为 github 解决了这个问题,但这不正常并且我想查明问题.
I sort of worked around it for github by using http://github.com
instead of git://github.com
, but this is not normal and I would like to pinpoint the problem.
谷歌搜索类似的问题,但提供的解决方案要么是拼写错误,要么是将域添加到主机文件中.
Googling for similar issues but the solutions offered was either typo correction, or adding domains to hosts file.
推荐答案
这听起来像是 DNS 问题.尝试切换到另一个 DNS 服务器,看看它是否有效.
This sounds like a DNS issue. Try switching to another DNS server and see if it works.
OpenDNS
- 208.67.222.222
- 208.67.220.220
- 8.8.8.8
- 8.8.4.4
这篇关于无法解析主机名,ping 有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!