如何手动设置DNS服务器? [英] How to set DNS servers manually?
问题描述
如何从Raspberry Pi中的DHCP租约请求中排除DNS?
How do I exclude DNS from the DHCP lease request on a Raspberry Pi?
我尝试更新 /etc/resolv.conf
但一段时间后重设。
I tried updating /etc/resolv.conf
but it's reset after a while.
原因:我在家庭网络,家庭路由器使用自己的DNS服务器,但路由器的DNS服务有时无法正常工作。
Reason: I am on a home network, and the home router uses itself as the DNS server, but the router's DNS service isn't working properly sometimes.
推荐答案
我发现问题是,dhcpclient获取有关DNS服务器的新信息每个dhcp更新。将此行添加到/etc/dhcp/dhclient.conf中:
I asume the problem is, that the dhcpclient is getting new information about DNS servers with every dhcp-renewal. Add this line into /etc/dhcp/dhclient.conf:
option domain-name-servers 192.168.1.8, 8.8.8.8, 8.8.4.4
当然,您应该将IP地址替换为您所要求的DNS服务器。可能重新启动相应的服务。
Of course you should replace the ip-addresses with the ones from your demanded DNS server. Probably restart the according service.
这篇关于如何手动设置DNS服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!