参考 ubuntu系统上systemd-resolved不使用127.0.0.53的方法

先修改/run/systemd/resolve/resolv.conf的内容,填自定义的dns服务器。
然后将软连接强制指向他:

ln -s -f /run/systemd/resolve/resolv.conf /etc/resolv.conf
systemctl daemon-reload && systemctl restart systemd-resolved.service && systemctl status -l systemd-resolved.service --no-pager
cat /etc/resolv.conf

还有参考 Ubuntu 20.04设置DNS解析(解决resolve.conf被覆盖问题),要修改/etc/systemd/resolved.conf,添加DNS字段

更多推荐