curl: (6) Couldn’t resolve host ‘www.ttlsa.com’
上周, 部分站点出现Couldn't resolve host.....问题, 导致公司所有走api的程序都无法正常使用(系统redhat 6.3的都出现问题, redhat 5一切OK). 最后解决方法找到了,但是具体原因目前还未知.
从这个报错,可以很明显的发现是域名解析不了。于是做如下排查。
1. 故障排除
1. 1 测试域名是否能解析到
简单的使用ping来测试,发现DNS解析是OK。
PING www.ttlsa.com (173.255.219.122) 56(84) bytes of data.
64 bytes from rpms.adiscon.com (173.255.219.122): icmp_seq=1 ttl=51 time=222 ms
|
1
2
3
|
# ping -c 1 www.ttlsa.com
PING www.ttlsa.com (173.255.219.122) 56(84) bytes of data.
64 bytes from rpms.adiscon.com (173.255.219.122): icmp_seq=1 ttl=51 time=222 ms
|
1.2 测试curl是否有故障
因为php程序调用的是curl,所以我们测试一下curl是否能够正常解析dns
curl: (6) Couldn't resolve host 'www.ttlsa.com'
|
1
2
|
# curl www.ttlsa.com
curl: (6) Couldn't resolve host 'www.ttlsa.com'
|
竟然真的不行,这种奇葩问题首次遇到.
2. 解决问题
尝试解决方法:
修改dns
nameserver 218.85.157.99
nameserver 218.85.152.99
改为
nameserver 114.114.114.114
nameserver 8.8.8.8
|
1
2
3
4
5
6
|
# cat /etc/resolv.conf | grep names
nameserver 218.85.157.99
nameserver 218.85.152.99
改为
nameserver 114.114.114.114
nameserver 8.8.8.8
|
重新测试curl,问题得到解决。
3. ttlsa群友提供解决方法
于此同时,群里的一个福建群友在也反应这个问题,看来应该是电信DNS有调整的缘故,但是具体的原因还是不得而知。告知其修改dns,问题也得到解决。
今天ttlsa群里的"福州 - 要上天"(藏得很深很低调的大牛)询问此问题是否解决,并提供另外的解决方法。
3.1 执行curl指定ipv4
|
1
|
curl -4 www.baidu.com
|
3.2 关闭ipv6
请参考CentOS6 / RHCE6 禁用IPv6协议模块:http://www.ttlsa.com/html/3640.html
如果是php程序,那么请在使用curl的时候指定ipv4的参数:CURL_IPRESOLVE_V4
感谢群友提供的解决方案. 如果你也遇到如上问题,不烦尝试下上面的解决方案.
4. curl无法解析原因
本文发出之后, 咱们ttlsa群主"north-boy"也找到原因所在,并且在“CentOS6 / RHCE6 禁用IPv6协议模块”提到,请看网址:http://www.ttlsa.com/html/3640.html
站点:运维生存时间 网址:http://www.ttlsa.com/html/3631.html
curl: (6) Couldn’t resolve host ‘www.ttlsa.com’的更多相关文章
- curl: (6) Couldn’t resolve host ‘www.ttlsa.com’【转】
上周, 部分站点出现Couldn't resolve host.....问题, 导致公司所有走api的程序都无法正常使用(系统redhat 6.3的都出现问题, redhat 5一切OK). 最后解 ...
- CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误: Could not retrieve mirrorlist http://mirrorlist.cen ...
- Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
- curl: (6) Could not resolve host: www.baidu.com;
今天,在执行curl时,突然发现这个报错,问题是之前完全没有出现过这样的情况. [root@localhost ~]# curl www.baidu.comcurl: (6) Could not re ...
- yum 安装报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
[root@venn09 ~]# yum install -y vim Loaded plugins: fastestmirror Could not retrieve mirrorlist http ...
- yum安装软件报错:curl#6 - "Could not resolve host: mirrorlist.centos.org; Temporary failure in name resolut
# yum install -y epel-release Loaded plugins: fastestmirror Repository base is listed more than once ...
- 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误" One of the configured ...
- url: (6) Couldn’t resolve host ‘www.ttlsa.com’
http://www.ttlsa.com/linux/curl-6-couldnt-resolve-host/ 2. 解决问题 尝试解决方法: 修改dns # cat /etc/resolv.conf ...
- 『cURL』curl: (6) Could not resolve host无法解析主机地址
最近在学数据挖掘时,获取数据有两种途径: 开放数据,可以直接使用和存储的数据: 网络数据,通过爬虫或云市场api(付费或免费)获取数据 我通过教程,在阿里云购买一个天气数据api,尝试使用cURL获取 ...
随机推荐
- JAVA 年老代收集器 第10节
JAVA 年老代收集器 第10节 上一章我们讲了新生代的收集器,那么这一章我们要讲的就是关于老年代的一些收集器.老年代的存活的一般是大对象以及生命很顽强的对象,因此新生代的复制算法很明显不能适应该区域 ...
- LintCode (9)Fizz Buzz
下面是AC代码,C++风格: class Solution { public: vector<string> fizzBuzz(int N) { vector<string> ...
- EC读书笔记系列之3:条款5、条款6、条款7
条款5:了解C++默默编写并调用哪些函数 记住: ★编译器可以(仅仅是可以,并非必须,仅当程序中有这样的用法时才会这么做!!!)暗自为class创建default构造函数,copy构造函数,copy ...
- boost signal2 trackable
挺简单的一个类,只是维护了一个成员 shared_ptr<detail::trackable_pointee> _tracked_ptr; 这样看来的话,所谓的track还是基于智能指针, ...
- threadid=1: thread exiting with uncaught exception (group=0x40db8930)
异常信息如下: 07-26 17:23:49.521: W/dalvikvm(29229): threadid=1: thread exiting with uncaught exception (g ...
- HTML5兼容IE各版本的写法
IE下判断IE版本的语句 <!--[if lte IE 6]> <![endif]--> IE6及其以下版本可见 <!--[if lte IE 7]> < ...
- 动态Script标签 解决跨域问题
动态Script 解决跨域问题 1.动态创建scriptcreateScript : function(src){ var varScript = document.createElement(&q ...
- hdu 5724 Chess 博弈
题目链接 一个n行20列的棋盘. 每一行有若干个棋子. 两人轮流操作, 每人每次可以将一个棋子向右移动一个位置, 如果它右边有一个棋子, 就跳过这个棋子, 如果有若干个棋子, 就将这若干个都跳过. 但 ...
- OpenCV学习 4:摄像头视频读写与边缘检测
原创文章,欢迎转载,转载请注明出处 想实现人脸识别,车辆识别,车牌识别.一般我们可不是读硬盘里面的视频文件的,都是直接从摄像头读取视频流然后直接识别的.所以读取摄像头的视频流这是基础...OpenCV ...
- 几种改变Activity回退栈默认行为的Intent Flag
FLAG_与LaunchMode相比最大的不同是临时性 1.FLAG_ACTIVITY_NEW_TASK: Developer.android.com的说法: (1)在新的task中启动这个Activ ...