2022-01-02 21:21:20 +00:00
|
|
|
|
Manage DNS and DoH servers from netwatch
|
|
|
|
|
========================================
|
|
|
|
|
|
2023-01-10 13:45:27 +00:00
|
|
|
|
[⬅️ Go back to main README](../README.md)
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
2022-02-12 12:05:56 +00:00
|
|
|
|
> ℹ️ **Info**: This script can not be used on its own but requires the base
|
2022-02-11 22:34:39 +00:00
|
|
|
|
> installation. See [main README](../README.md) for details.
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
This script reads server state from netwatch and manages used DNS and
|
|
|
|
|
DoH (DNS over HTTPS) servers.
|
|
|
|
|
|
|
|
|
|
Requirements and installation
|
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
|
|
Just install the script:
|
|
|
|
|
|
|
|
|
|
$ScriptInstallUpdate netwatch-dns;
|
|
|
|
|
|
|
|
|
|
Then add a scheduler to run it periodically:
|
|
|
|
|
|
2022-05-11 08:19:11 +00:00
|
|
|
|
/system/scheduler/add interval=1m name=netwatch-dns on-event="/system/script/run netwatch-dns;" start-time=startup;
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
|
|
|
|
Configuration
|
|
|
|
|
-------------
|
|
|
|
|
|
|
|
|
|
The DNS and DoH servers to be checked have to be added to netwatch with
|
|
|
|
|
specific comment:
|
|
|
|
|
|
2022-07-05 11:16:47 +00:00
|
|
|
|
/tool/netwatch/add comment="doh" host=1.1.1.1;
|
|
|
|
|
/tool/netwatch/add comment="dns" host=8.8.8.8;
|
2022-07-05 11:29:00 +00:00
|
|
|
|
/tool/netwatch/add comment="doh, dns" host=9.9.9.9;
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
|
|
|
|
This will configure *cloudflare-dns* for DoH (`https://1.1.1.1/dnsquery`), and
|
2022-07-05 11:29:00 +00:00
|
|
|
|
*google-dns* and *quad-nine* for regular DNS (`8.8.8.8,9.9.9.9`) if up.
|
2022-01-02 21:21:20 +00:00
|
|
|
|
If *cloudflare-dns* is down the script will fall back to *quad-nine* for DoH.
|
|
|
|
|
|
|
|
|
|
Giving a specific query url for DoH is possible:
|
|
|
|
|
|
2022-09-13 09:05:16 +00:00
|
|
|
|
/tool/netwatch/add comment="doh, doh-url=https://dns.nextdns.io/dns-query" host=199.247.16.158;
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
|
|
|
|
Note that using a name in DoH url may introduce a chicken-and-egg issue!
|
|
|
|
|
|
2022-09-13 07:01:40 +00:00
|
|
|
|
Importing a certificate automatically is possible, at least if available in
|
|
|
|
|
the repository (see `certs` sub directory).
|
|
|
|
|
|
|
|
|
|
/tool/netwatch/add comment="doh, doh-cert=DigiCert TLS Hybrid ECC SHA384 2020 CA1" host=1.1.1.1;
|
|
|
|
|
/tool/netwatch/add comment="doh, doh-cert=DigiCert TLS Hybrid ECC SHA384 2020 CA1" host=9.9.9.9;
|
|
|
|
|
/tool/netwatch/add comment="doh, doh-cert=GTS CA 1C3" host=8.8.8.8;
|
|
|
|
|
|
2022-01-02 21:21:20 +00:00
|
|
|
|
Sometimes using just one specific (possibly internal) DNS server may be
|
|
|
|
|
desired, with fallback in case it fails. This is possible as well:
|
|
|
|
|
|
2022-07-05 11:16:47 +00:00
|
|
|
|
/tool/netwatch/add comment="dns" host=10.0.0.10;
|
|
|
|
|
/tool/netwatch/add comment="dns-fallback" host=1.1.1.1;
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
|
|
|
|
Tips & Tricks
|
|
|
|
|
-------------
|
|
|
|
|
|
|
|
|
|
### Use in combination with notifications
|
|
|
|
|
|
|
|
|
|
Netwatch entries can be created to work with both - this script and
|
|
|
|
|
[netwatch-notify](netwatch-notify.md). Just give options for both:
|
|
|
|
|
|
2022-07-05 11:23:34 +00:00
|
|
|
|
/tool/netwatch/add comment="doh, notify, name=cloudflare-dns" host=1.1.1.1;
|
2022-01-02 21:21:20 +00:00
|
|
|
|
|
|
|
|
|
Also this allows to update host address, see option `resolve`.
|
|
|
|
|
|
|
|
|
|
See also
|
|
|
|
|
--------
|
|
|
|
|
|
|
|
|
|
* [Notify on host up and down](netwatch-notify.md)
|
|
|
|
|
|
|
|
|
|
---
|
2023-01-10 13:45:27 +00:00
|
|
|
|
[⬅️ Go back to main README](../README.md)
|
|
|
|
|
[⬆️ Go back to top](#top)
|