Maverickcdn
Senior Member
Winter is upon us and cold weather brings inane indoor projects...
Im learning shell coding and would like some input on something Im wasting my time with for fun (at least its fun to me)
I run a PI as a server on my network and it handles most everything including DNS with DoH through DNSCRYPT, also I provide filtered Internet access to roomates, instead of DNS on my router Id prefer a test/failover option. Please dont tell me to just run DNS from my router, Im doing this as a learning project.
As I've read and experienced with DNSMASQ on my router the option 'strict-order' works.... but it doesnt work, flaky at best anyway. I find personally when primary dns fails and dnsmasq moves to the secondary it can take a really long time for it to revert back to primary when it is up again (ie, my PI). I tinker a lot and the PI can be up or down for various periods of time on a given day that Im tinkering with it.
Looking for some community input on what would be the best way to script an 'if statement' to confirm DNS resolving is still up.
Id like to make my script available in the end but dont want to install any additional packages so Im thinking Im only left with curl (currently using) and nslookup. I have a timer setting to filter cached responses, but thinking my current curl method is far from ideal. And with nslookup I cant figure out how to set a timeout option when dns is failing, currently if a lookup is failing nslookup can hang for a long time before giving a result.
Of course most Internet searches recommend people use dig, which is not an option as it requires installing extra packages, something Id like to avoid.
Just wondering if anyone has some thoughts on what we be a fairly reliable way to test DNS resolution in a script from the router??
Im learning shell coding and would like some input on something Im wasting my time with for fun (at least its fun to me)
I run a PI as a server on my network and it handles most everything including DNS with DoH through DNSCRYPT, also I provide filtered Internet access to roomates, instead of DNS on my router Id prefer a test/failover option. Please dont tell me to just run DNS from my router, Im doing this as a learning project.
As I've read and experienced with DNSMASQ on my router the option 'strict-order' works.... but it doesnt work, flaky at best anyway. I find personally when primary dns fails and dnsmasq moves to the secondary it can take a really long time for it to revert back to primary when it is up again (ie, my PI). I tinker a lot and the PI can be up or down for various periods of time on a given day that Im tinkering with it.
Looking for some community input on what would be the best way to script an 'if statement' to confirm DNS resolving is still up.
Id like to make my script available in the end but dont want to install any additional packages so Im thinking Im only left with curl (currently using) and nslookup. I have a timer setting to filter cached responses, but thinking my current curl method is far from ideal. And with nslookup I cant figure out how to set a timeout option when dns is failing, currently if a lookup is failing nslookup can hang for a long time before giving a result.
Of course most Internet searches recommend people use dig, which is not an option as it requires installing extra packages, something Id like to avoid.
Just wondering if anyone has some thoughts on what we be a fairly reliable way to test DNS resolution in a script from the router??