1. 程式人生 > >curl: (6) Could not resolve host: www.baidu.com;

curl: (6) Could not resolve host: www.baidu.com;

Could not resolve ho

今天,在執行curl時,突然發現這個報錯,問題是之前完全沒有出現過這樣的情況。


[root@localhost ~]# curl www.baidu.com

curl: (6) Could not resolve host: www.baidu.com; 未知的錯誤

上網了解了一下,都說是DNS的問題,因此修改一下DNS配置


[root@localhost ~]# vim /etc/resolv.conf

[root@centos yum.repos.d]# cat /etc/resolv.conf

# Generated by NetworkManager

# No nameservers found; try putting DNS servers into your

# ifcfg files in /etc/sysconfig/network-scripts like so:

#

# DNS1=xxx.xxx.xxx.xxx

# DNS2=xxx.xxx.xxx.xxx

# DOMAIN=lab.foo.com bar.foo.com

nameserver 114.114.114.114 #添加DNS

nameserver 8.8.8.8


結果只是加上了nameserver 114.114.114.114就可以了,網上了解到的可能是電信DNS有調整的緣故,但是具體的原因還是不得而知。


curl: (6) Could not resolve host: www.baidu.com;