Ubuntu24.04修改DNS
vi /etc/systemd/resolved.conf
打开resolved.conf文件写入
DNS=8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
FallbackDNS=1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
重启systemd-resolved
systemctl status systemd-resolved #查看状态,没有开机自启就enable一下。
systemctl enable systemd-resolved
systemctl restart systemd-resolved
打开/etc/netplan/50.cloud-init.yaml, dhcp4下添加两行,注意图中缩进
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
应用设置
netplan apply
resolvectl status #查看生效的dns
阅读剩余
版权声明:
作者:konoha
链接:https://konoha.cc/ubuntu24-04%e4%bf%ae%e6%94%b9dns.html
文章版权归作者所有,未经允许请勿转载。
THE END