无法解析主机名,可以ping通 [英] Could not resolve hostname, ping works

查看:571
本文介绍了无法解析主机名,可以ping通的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了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.

使用Google搜索类似问题,但提供的解决方案是错字更正或将域添加到主机文件.

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

GoogleDNS

  • 8.8.8.8
  • 8.8.4.4

这篇关于无法解析主机名,可以ping通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆