Hello! 欢迎来到小浪云!


Ubuntu20系统里面PING不通域名,如何设置dns并生效


avatar
小浪云 2024-07-06 184


vi /etc/systemd/resolved.conf

将resolved.conf内容中的 #dns= 改为 dns8.8.8.8

保存后 ,继续执行以下命令,逐行复制并执行

systemctl restart systemd-resolved

systemctl enable systemd-resolved

mv /etc/resolv.conf  /etc/resolv.conf.bak

ln -s /run/systemd/resolve/resolv.conf /etc/

cat /etc/resolv.conf    #查看dns文件再次PING 域名,就会发现正常了。

相关阅读