How do I exclude DNS from the DHCP lease request on a Raspberry Pi?
I tried updating /etc/resolv.conf
but it's reset after a while.
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.
The independent DNS monitor DNSPerf ranks 1.1.1.1 the fastest DNS service in the world. Since nearly everything you do on the Internet starts with a DNS request, choosing the fastest DNS directory across all your devices will accelerate almost everything you do online.
That is not recommended and may even be a violation of your security policies, depending on the level of security required in your organization or by any governing agency. DNS forwarders that only point to 8.8. 8.8 are using your ISP connection to hop to 8.8. 8.8 when resolving DNS.
8.8. 8.8 is a public DNS recursive operated by Google. Configuring to use that instead of your default means that your queries go to Google instead of to your ISP.
8.8. 4.4 is the secondary DNS server for Google Public DNS. Google Public DNS is a global DNS service that is run by Google for the purpose of making the Internet and the DNS system faster, safer, secure, and more reliable for everyone online.
Most of the answers didn't work for me, but I found that this worked:
sudo vi /etc/dhcpcd.conf
Added a line (note that there is no comma):
static domain_name_servers=8.8.8.8 8.8.4.4
And unplugged and replugged my ethernet cable, which updates the resolver...
cat /etc/resolv.conf
Now shows:
# Generated by resolvconf
domain example.com
nameserver 8.8.8.8
nameserver 8.8.4.4
This also a better way to fix the problem where changes to /etc/resolv.conf
are lost on reboot.
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
Of course you should replace the ip-addresses with the ones from your demanded DNS server. Probably restart the according service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With