Page 1 of 1
Google DNS
Posted: Wed Nov 13, 2024 12:02 am
by ozsouth
I made a script to set google ipv4 dns as nameservers. Enables faster surfing & is apparently secure
- see: https://developers.google.com/speed/pub ... docs/intro (also has ipv6 info).
It needs to run after dhcp has set it's default.
16Nov24 EDIT: simpler, ok solution is 3 posts down.
As I have a savefolder, to make it run after dhcp settings, I needed a sleep 8 (may need 12)
To make it run last & not hold up other processes, I called it zsetresgoo , made it executable & put it in /root/Startup
The first echo overwrites resolv.conf & the second echo appends that file
Code: Select all
#!/bin/sh
sleep 8
echo nameserver 8.8.8.8 > /etc/resolv.conf
echo nameserver 8.8.4.4 >> /etc/resolv.conf
An issue - if you suspend (i.e. close laptop lid), upon resume, previous settings return. A hack fix is to add the
following code to the end of /etc/acpi/actions/suspend.sh (optimal timings can vary with different pcs)
Code: Select all
sleep 16
echo nameserver 8.8.8.8 > /etc/resolv.conf
echo nameserver 8.8.4.4 >> /etc/resolv.conf
Re: Google DNS
Posted: Fri Nov 15, 2024 2:51 pm
by wizard
@ozsouth
Have my DNS server choice set in my router, then all DHCP devices use that. Otherwise, if you set a static IP you can specify the DNS there.
Thanks
wizard
Re: Google DNS
Posted: Fri Nov 15, 2024 3:04 pm
by Trapster
Isn't that what /etc/resolv.conf.head and /etc/resolv.conf.tail is for?
Re: Google DNS
Posted: Sat Nov 16, 2024 12:12 am
by ozsouth
@Trapster - sort of. I wanted to obliterate the original settings (mine picks the router ip & 0.0.0.0).
Making file /etc/resolv.conf.head , containing just
nameserver 8.8.8.8
nameserver 8.8.4.4
gives google dns priority, but system could possibly use the original lame duck entries.
Note, to activate changes, need to reboot with save, or run in terminal: killall dhcpcd then dhcpcd
As it is simpler for most folk overall, yes, I now recommend using /etc/resolv.conf.head
Re: Google DNS
Posted: Sat Nov 16, 2024 8:12 pm
by darksun
DNS wise, I also would recommend to take in consideration:
- using the operating system's default network manager as main way to manage them, this in order to avoid possible situation where the system DNSs get overwritten by it in some scenarios;
- https://www.privacyguides.org/en/dns/ a source of private secure and fast DNS resolvers
- local encrypted DNS stub resolver, such as :
leafpad /etc/stubby/stubby.yml
Re: Google DNS
Posted: Sun Nov 24, 2024 6:32 pm
by SteveS
Now, there is an easier way to change DNS Servers with a .pet created by @wizard here:
viewtopic.php?t=13135
I hope this helps.