分析原因:
域名解析失败,这可能是与DNS服务器地址有关,通过命令:sudo gedit /etc/resolv.conf ,查看DNS地址为:nameserver 127.0.1.1。整个文件为:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search localdomain
解决方法:
在windows环境下打开cmd,输入:ipconfig /all得到主机的DNS地址:
然后将主机的DNS地址加入到resolv.conf文件中,更改后如下:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
nameserver 202.117.0.20
search localdomain
然后重启虚拟机即可
原文链接:https://www.f2er.com/ubuntu/352208.html