curl:(6)无法解析主机:google.com;姓名或服务未知 [英] curl: (6) Could not resolve host: google.com; Name or service not known
问题描述
当我尝试加载网页到终端它给出 curl:(6)无法解决主机
错误。
when I try to load a web page to terminal it gives curl: (6) Could not resolve host
error.
我在我的电脑上有互联网,并尝试从我的家庭互联网连接。所以我没有任何代理涉及这里。
I have internet in my PC and trying from my home internet connection. So as I there is no any proxy involve here.
[root@localhost kevin]# curl http://google.com
curl: (6) Could not resolve host: google.com; Name or service not known
清除所有
再试一次,但没有幸运。
clean all
and tried again but no lucky.
但是如果我使用IP而不是域名,它工作正常。
But if I use IP instead of the domain name, it works fine.
[root @ localhost kevin]#curl http://173.194.46.0
任何线索?
推荐答案
问题是:
- 启用IPV6
- DNS服务器错误
以下是我如何解决此问题:
Here is how I fixed it:
IPV6停用
- 打开终端
- 键入
su
,然后输入以超级用户身份登录 - 输入根密码
- 键入
cd /etc/modprobe.d /
将目录更改为etc / modprobe.d /
- 输入
vi disableipv6.conf
li>
- 按
Esc + i
将数据插入文件 - 键入
ipv6 / bin / true
以避免加载IPV6相关模块 - 输入
Esc +:
然后wq
保存并退出 - 输入
reboot
li>
- 重新启动后打开终端并键入
lsmod | grep ipv6
- 如果没有结果,则表示您已正确停用IPV6
- Open Terminal
- Type
su
and enter to log in as the super user - Enter the root password
- Type
cd /etc/modprobe.d/
to change directory to/etc/modprobe.d/
- Type
vi disableipv6.conf
to create a new file there - Press
Esc + i
to insert data to file - Type
install ipv6 /bin/true
on the file to avoid loading IPV6 related modules - Type
Esc + :
and thenwq
for save and exit - Type
reboot
to restart fedora - After reboot open terminal and type
lsmod | grep ipv6
- If no result, it means you properly disabled IPV6
添加Google DNS服务器
- 打开终端
-
su
并输入以超级用户身份登录 - 输入root密码
-
cat /etc/resolv.conf
以检查您的Fedora使用的DNS服务器。 - 现在我们必须找到一个强大的DNS服务器。幸运的是有一个由Google维护的开放DNS服务器。
- 转到此页,并找出Google公共DNS IP地址是什么
- 今天是
8.8.8.8
和
8.8.4.4
。 - 输入
vi /etc/resolv.conf
编辑resolv。 conf
档案 - 按
Esc + i
可将档案插入档案 - 通过在每行的开头插入#来注释文件中的所有内容。
-
在文件中键入以下两行。
- Open Terminal
- Type
su
and enter to log in as the super user - Enter the root password
- Type
cat /etc/resolv.conf
to check what DNS server your Fedora using. Mostly this will be your Modem IP address. - Now we have to Find a powerful DNS server. Luckily there is a open DNS server maintain by Google.
- Go to this page and find out what are the "Google Public DNS IP addresses"
- Today those are
8.8.8.8
and8.8.4.4
. But in future those may change. - Type
vi /etc/resolv.conf
to edit theresolv.conf
file - Press
Esc + i
for insert data to file - Comment all the things in the file by inserting # at the begin of the each line. Do not delete anything because can be useful in future.
Type below two lines in the file
名称服务器8.8。 8.8
nameserver 8.8.4.4
nameserver 8.8.8.8
nameserver 8.8.4.4
-Type Esc +:
,然后 wq
保存并退出
-Type Esc + :
and then wq
for save and exit
这是我的博客文章:
http:// codeketchup.blogspot.sg/2014/07/how-to-fix-curl-6-could-not-resolve.html
这篇关于curl:(6)无法解析主机:google.com;姓名或服务未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!