在Ubuntu中,如何禁用systemd-resolved?

・2 分钟阅读

问题

如何在Ubuntu 17.04中禁用systemd-resolved?


回答1

注意:对于某些用户,禁用systemd resolved可能会破坏VPN中的名称解析,

禁用systemd已解决的服务并将它停止:


sudo systemctl disable systemd-resolved.service


sudo service systemd-resolved stop



在你的[main]部分中放置以下行 /etc/NetworkManager/NetworkManager.conf

 
dns=default



 

删除符号链接/etc/resolv.conf


rm /etc/resolv.conf



重新启动网络管理器


sudo service network-manager restart




回答2

绞尽脑汁后的解决方案是编辑/etc/systemd/resolved. conf :


[Resolve]


DNS=192.168.1.254 # <-- change to your router address


#FallbackDNS=8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844


Domains=lan # <-- change to your localdomain name (maybe .local)


#LLMNR=yes <-- I dabbled with this for a while but it doesn't matter


#DNSSEC=no


#Cache=yes


#DNSStubListener=udp




sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf




ln -sf /var/run/resolved/resovl.conf /etc/resolv.conf


讨论
Tianye profile image