curl: (6) Could not resolve host: 需設置nameserver

今天,在執行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有調整的緣故,但是具體的原因還是不得而知。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章