mac dns查找不当行为 [英] mac dns look up misbehaving

查看:201
本文介绍了mac dns查找不当行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个新的mac,现在我试图安装/更新一些东西。我得到的第一个问题是,内部脚本/程序(例如git或ruby gem)中的http请求不起作用。我将在下面介绍我使用的解决方法,因为它比任何解释更好地说明了问题。任何帮助不胜感激!

  Leonardos-MacBook-Air:〜leo $ git clone git://github.com/sstephenson/ rbenv.git .rbenv 
克隆到'.rbenv'...
致命:无法查找github.com(端口9418)(提供nodename或servname,或未知)
#它不能找到github.com

Leonardos-MacBook-Air:〜leo $ ping github.com
PING github.com(207.97.227.239):56个数据字节
64字节从207.97.227.239:icmp_seq = 0 ttl = 50时间= 104.279毫秒
从207.97.227.239的64字节:icmp_seq = 1 ttl = 50时间= 105.658毫秒
#它找到它在一个ping,卷曲,甚至浏览器。这表明它不是网络(代理)问题


不是ELEGANT解决方案
Leonardos-MacBook-Air:〜leo $ cat / etc / hosts
# #
#主机数据库

#localhost用于在系统启动时配置环回接口
#。不要更改此条目。
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
:: 1 localhost
fe80 :: 1%lo0 localhost
207.97.227.239 github。 com
#我在/ etc / hosts文件中添加了最后一行

Leonardos-MacBook-Air:〜leo $ git clone git://github.com/sstephenson/rbenv.git .rbenv
克隆到'.rbenv'...
remote:计数对象:1040,完成。
remote:压缩对象:100%(419/419),完成。
remote:总共1040(delta 650),重用959(delta 593)
接收对象:100%(1040/1040),138.25 KiB,完成。
解决三角洲:100%(650/650),完成。
#now it works


解决方案

DNS服务器是这里的罪魁祸首。将路由器的DNS设置更改为 Google的公共DNS 后。


Got a new mac and now I'm trying to install/update some stuff. THe first issue I get is that http requests made from inside scripts/programs (such as git or ruby gem) doesn't work. I'll put an example below of the workaround I used because it illustrates the issue better than any explanation. Any help is appreciated!

Leonardos-MacBook-Air:~ leo$ git clone git://github.com/sstephenson/rbenv.git .rbenv
Cloning into '.rbenv'...
fatal: Unable to look up github.com (port 9418) (nodename nor servname provided, or not known)
# it can not find github.com

Leonardos-MacBook-Air:~ leo$ ping github.com
PING github.com (207.97.227.239): 56 data bytes
64 bytes from 207.97.227.239: icmp_seq=0 ttl=50 time=104.279 ms
64 bytes from 207.97.227.239: icmp_seq=1 ttl=50 time=105.658 ms
# it finds it in a ping, curl, or even a browser. this shows that it's not a network (proxy) issue


NOT SO ELEGANT SOLUTION
Leonardos-MacBook-Air:~ leo$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost
207.97.227.239  github.com
# I added this last line in the /etc/hosts file

Leonardos-MacBook-Air:~ leo$ git clone git://github.com/sstephenson/rbenv.git .rbenv
Cloning into '.rbenv'...
remote: Counting objects: 1040, done.
remote: Compressing objects: 100% (419/419), done.
remote: Total 1040 (delta 650), reused 959 (delta 593)
Receiving objects: 100% (1040/1040), 138.25 KiB, done.
Resolving deltas: 100% (650/650), done.
# now it works

解决方案

My damn ISP's DNS server was the culprit here. After changing my router's DNS settings to Google's public DNS.

这篇关于mac dns查找不当行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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