Ubuntu 18.04 ping 出现 Temporary failure in name resolution

Temporary failure in name resolution 错误解决方法:

1
vim /etc/resolv.conf

将里面的 nameserver 注释掉,尝试填写以下内容到文件中:

1
2
nameserver 114.114.114.114
nameserver 8.8.8.8

can not resovle host xxx 错误解决方法:

修改 /etc/hosts

1
sudo vim /etc/hosts
1
2
127.0.0.1 localhost
127.0.0.1 <your hostname>

References