Ubuntu中可以使用NetworkManager來(lái)設(shè)置resolv.conf的自動(dòng)更新??梢园凑找韵虏襟E進(jìn)行操作:
sudo nano /etc/NetworkManager/NetworkManager.conf
[main]
dns=systemd-resolved
sudo systemctl restart NetworkManager
cat /etc/resolv.conf
通過(guò)以上步驟設(shè)置后,NetworkManager會(huì)自動(dòng)更新resolv.conf文件,并將DNS服務(wù)器信息添加到該文件中。