TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
3.82k stars 397 forks source link

Failover App does not what I expect. #925

Closed MK796 closed 1 week ago

MK796 commented 1 month ago

Hello! (EDIT: I don't know why on earth the code format is so f--- up.... sorry for that)

actual behaviour: TXT query is showing "healthStatus=Unknown;"

expected behaviour: TXT query Is showing the correct health status and is therefore either returning the primary or the secondary IP with a normal DNS request.

actions performed: I tired several configurations. I used as "type" ping and https. First I queried the A record and than the txt record.

APP CONFIG:

{ "healthChecks": [ { "name": "ping", "type": "ping", "interval": 60, "retries": 3, "timeout": 10, "emailAlert": "default", "webHook": "default" }, { "name": "tcp80", "type": "tcp", "interval": 60, "retries": 3, "timeout": 10, "port": 80, "emailAlert": "default", "webHook": "default" }, { "name": "tcp443", "type": "tcp", "interval": 60, "retries": 3, "timeout": 10, "port": 443, "emailAlert": "default", "webHook": "default" }, { "name": "http", "type": "http", "interval": 60, "retries": 3, "timeout": 10, "url": null, "emailAlert": "default", "webHook": "default" }, { "name": "https", "type": "https", "interval": 60, "retries": 3, "timeout": 10, "url": null, "emailAlert": "default", "webHook": "default" }, { "name": "cloud", "type": "https", "interval": 60, "retries": 3, "timeout": 10, "url": "https://cloud.mk-homelab.net", "emailAlert": "default", "webHook": "default" } ], "emailAlerts": [ { "name": "default", "enabled": false, "alertTo": [ "admin@example.com" ], "smtpServer": "smtp.example.com", "smtpPort": 465, "startTls": false, "smtpOverTls": true, "username": "alerts@example.com", "password": "password", "mailFrom": "alerts@example.com", "mailFromName": "DNS Server Alert" } ], "webHooks": [ { "name": "default", "enabled": false, "urls": [ "https://webhooks.example.com/default" ] } ], "underMaintenance": [ { "network": "192.168.178.1/24", "enabled": false } ] }

DNS ENTRY CONFIG

as name of the record is set the actual FQDN

{ "primary": [ "192.168.178.111" ], "secondary": [ "192.168.178.112" ], "serverDown": [ "192.168.178.113" ], "healthCheck": "cloud", "healthCheckUrl": "https://cloud.mk-homelab.net", "allowTxtStatus": true }

DNS query response:

"Answer": [ { "Name": "cloud.mk-homelab.net", "Type": "TXT", "Class": "IN", "TTL": "30 (30 sec)", "RDLENGTH": "147 bytes", "RDATA": { "Text": "app=failover; addressType=Primary; address=192.168.178.111; healthCheck=cloud; healthCheckUrl=https://cloud.mk-homelab.net/; healthStatus=Unknown;" }, "DnssecStatus": "Disabled" }, { "Name": "cloud.mk-homelab.net", "Type": "TXT", "Class": "IN", "TTL": "30 (30 sec)", "RDLENGTH": "149 bytes", "RDATA": { "Text": "app=failover; addressType=Secondary; address=192.168.178.112; healthCheck=cloud; healthCheckUrl=https://cloud.mk-homelab.net/; healthStatus=Unknown;" }, "DnssecStatus": "Disabled" }

ShreyasZare commented 1 month ago

Thanks for the post. The Failover App's health checkup starts only when the record is queried first and health checkup will stop if the domain is not queried for more than 1 hour.

So, to test your setup, first make and A request using the DNS client tab then keep making TXT requests for a few seconds. It may take a minute or so to show the correct health status if the health check is failing due to timeout reasons. After a minute (depending the main config retries and timeout), you will see the correct status in the TXT response.

Note that you will see health status only for the primary answer with this test. The secondary health test is only done if primary server fails. Also, do check the DNS logs from the panel to see if there were any errors logged by the failover app.

Do let me know if you were able to get it working as expected.