Linux虚拟机ping不通域名

转载:https://blog.csdn.net/weixin_38196258/article/details/84287734

问题:在进行Docker镜像发布时,发现访问不了Docker Hub,后测试ping baidu.com也不行,但ping IP地址可以

添加DNS

vim /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

重启NetworkManager

systemctl restart NetworkManager
ping baidu.com
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=128 time=62.2 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=128 time=55.1 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=3 ttl=128 time=59.7 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=4 ttl=128 time=57.2 ms

你可能感兴趣的:(Linux)