[{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/","section":"DervTech","summary":"","title":"DervTech","type":"page"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/dns/","section":"Tags","summary":"","title":"Dns","type":"tags"},{"content":" Why I did this # Everything at home depends on DNS. When my one DNS server went down, so did everything else.\nDHCP will happily hand out two DNS servers, so strictly speaking I didn\u0026rsquo;t need a shared IP. But based on my experience clients don\u0026rsquo;t fail over between DNS servers in any predictable way, and I wanted one address in the DHCP scope that just works, wherever the service is actually running. That\u0026rsquo;s what a VIP (virtual IP) gives you.\nA bigger reason for doing this is I love playing with tech and getting keepaliveD running in Docker that\u0026rsquo;s hosted on a QNAP NAS felt like a fun challenge that also fixed (a first world) problem 🎻\nWhat I built # Role Host IP Primary Technitium in a Proxmox LXC (dns1) 172.16.0.2 Backup Technitium in a container on my QNAP NAS (dns2) 172.16.0.3 VIP/keepaliveD (what DHCP hands out) Whichever node is MASTER 172.16.0.4 keepalived runs on both nodes and uses VRRP to decide who owns 172.16.0.4. The Proxmox node is primary because it has the higher priority in its config; the QNAP takes over if dns1 (172.16.0.2) disappears.\nThe Technitium side # Both servers run as a Technitium cluster, with DNS1 on Proxmox as the primary. Anything I change on the primary, whether zones, records or settings, is synced to DNS2 on the QNAP, so it doesn\u0026rsquo;t matter which node holds the VIP: both are authoritative for my internal .home zone and give the same answers.\nThe Technitium cluster: DNS1 on Proxmox as primary, DNS2 on the QNAP keepalived on Proxmox (primary) # This was the easy side: keepalived installed natively in the LXC with apt install keepalived.\nglobal_defs { notification_email { you@example.com } notification_email_from you@example.com smtp_server 172.16.0.x smtp_connect_timeout 5 vrrp_skip_check_adv_addr vrrp_garp_interval 1 vrrp_gna_interval 1 } vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 55 priority 255 advert_int 1 smtp_alert unicast_src_ip 172.16.0.2 unicast_peer { 172.16.0.3 } authentication { auth_type PASS auth_pass CHANGEME } virtual_ipaddress { 172.16.0.4 } } I use unicast VRRP (unicast_src_ip / unicast_peer) rather than multicast, so each node talks directly to the other.\nkeepalived on the QNAP (backup): where it got interesting # Gotcha 1: the container has its own IP # My first config put the VIP on the NAS\u0026rsquo;s br0 interface, and the health check failed with \u0026ldquo;connection refused\u0026rdquo;. Technitium on the QNAP doesn\u0026rsquo;t share the NAS\u0026rsquo;s IP (.31). Container Station gives it its own LAN address (.3). So the VIP has to live on Technitium\u0026rsquo;s interface, not the NAS\u0026rsquo;s.\nThe fix was to run keepalived inside Technitium\u0026rsquo;s network namespace:\nnetwork_mode: \u0026#34;container:technitium-dns-server2\u0026#34; Inside that namespace there\u0026rsquo;s no br0, just eth0, which keepalived happily told me in the logs (interface br0 ... doesn't exist).\nGotcha 2: DNS failover that depends on DNS # My first container installed keepalived at startup with apk add keepalived. That needs DNS to download the package, from inside the DNS server\u0026rsquo;s network\u0026hellip; It failed. Installing your DNS failover tool in a way that depends on DNS working is a nice circular dependency.\nThe fix was a tiny image with keepalived baked in, so nothing is downloaded at startup:\nFROM alpine:3.20 RUN apk add --no-cache keepalived ENTRYPOINT [\u0026#34;keepalived\u0026#34;, \u0026#34;-n\u0026#34;, \u0026#34;-l\u0026#34;, \u0026#34;-D\u0026#34;, \u0026#34;-f\u0026#34;, \u0026#34;/etc/keepalived/keepalived.conf\u0026#34;] sudo docker build --network host -t local/keepalived:1 /share/Container/keepalived/build And the Container Station app:\nservices: keepalived: image: local/keepalived:1 container_name: keepalived network_mode: \u0026#34;container:technitium-dns-server2\u0026#34; cap_add: - NET_ADMIN - NET_BROADCAST - NET_RAW restart: always volumes: - /share/Container/keepalived/keepalived.conf:/etc/keepalived/keepalived.conf:ro Gotcha 3: exit status 127 # The health check kept failing with status 127, which means \u0026ldquo;command not found\u0026rdquo;. Alpine\u0026rsquo;s nslookup lives in busybox, not /usr/bin. Calling /bin/busybox nslookup fixed it.\nGotcha 4: the two sides must agree # virtual_router_id and auth_pass must match on both nodes, or they\u0026rsquo;ll both claim MASTER and fight over the VIP. Mine didn\u0026rsquo;t at first (55 vs 53).\nThe final QNAP config # global_defs { router_id qnap-dns notification_email { you@example.com } notification_email_from you@example.com smtp_server 172.16.0.x 25 smtp_connect_timeout 5 enable_script_security script_user root } vrrp_script chk_dns { script \u0026#34;/bin/busybox nslookup -timeout=1 example.com 127.0.0.1\u0026#34; interval 5 timeout 3 fall 2 rise 2 weight -20 } vrrp_instance DNS_VIP { state BACKUP interface eth0 virtual_router_id 55 priority 100 advert_int 1 smtp_alert unicast_src_ip 172.16.0.3 unicast_peer { 172.16.0.2 } authentication { auth_type PASS auth_pass CHANGEME } virtual_ipaddress { 172.16.0.4/24 } track_script { chk_dns } } router_id qnap-dns puts the node name in the alert email subject, so I can tell which box sent it.\nOne thing to remember: if the Technitium container is recreated (for example after an image update), restart the keepalived container too, because it\u0026rsquo;s attached to the old container\u0026rsquo;s network.\nTesting failover # Here\u0026rsquo;s a fun interactive diagram to demonstrate what happens when one of the nodes goes offline\nClient dig @172.16.0.4 example.com Router 172.16.0.1 LAN 172.16.0.0/24 DNS1 · Proxmox LXC technitiumdns1 · 172.16.0.2 Technitium: up MASTER · 255 Click this box to power DNS1 off DNS2 · QNAP container technitium-dns-server2 · 172.16.0.3 Technitium: up BACKUP · 100 VRRP VIP 172.16.0.4 held by DNS1 Send DNS query to 172.16.0.4 Power off DNS1 I followed the QNAP\u0026rsquo;s log while stopping keepalived on the Proxmox host:\nsudo docker logs -f --tail 50 keepalived 2\u0026gt;\u0026amp;1 | grep -E \u0026#39;STATE|chk_dns|priority\u0026#39; keepalived doesn\u0026rsquo;t say \u0026ldquo;backup to master\u0026rdquo; in so many words. What you actually see is:\nLog line Meaning Backup received priority 0 advertisement The primary announced it was shutting down Entering MASTER STATE The QNAP took over setting VIPs 172.16.0.4 added to eth0 Sending gratuitous ARP Telling the network where .4 now lives DNS queries to 172.16.0.4 kept answering throughout. When I started keepalived on Proxmox again, the QNAP logged Master received advert from 172.16.0.2 with higher priority 255, ours 100, stepped back to BACKUP and released the VIP.\nAlerting and monitoring # Email: both nodes send an email through my local SMTP relay on every state change (smtp_alert).\nUptime Kuma: three DNS monitors (the VIP, node 1 and node 2) tell me whether DNS works and whether I still have redundancy. Two Push monitors, fed by a small cron script on each node, report whether keepalived is running and whether that node is MASTER or BACKUP. The role shows up as the message on each heartbeat, which I didn\u0026rsquo;t expect and really like.\n#!/bin/sh # Proxmox version; runs every minute from cron URL=\u0026#34;http://\u0026lt;kuma-ip\u0026gt;:3001/api/push/\u0026lt;token\u0026gt;\u0026#34; systemctl is-active --quiet keepalived || exit 1 ip -4 addr show eth0 | grep -q \u0026#39;172.16.0.4/\u0026#39; \u0026amp;\u0026amp; S=MASTER || S=BACKUP curl -fsS -o /dev/null \u0026#34;$URL?status=up\u0026amp;msg=$S\u0026#34; Both DNS servers, the VIP and keepalived on each node, all monitored in Uptime Kuma Each heartbeat reports which node currently holds the VIP Lessons learned and what\u0026rsquo;s next # Know where your container\u0026rsquo;s network really lives. A container with its own LAN IP is a different host as far as VRRP is concerned. Don\u0026rsquo;t make your DNS failover depend on DNS. Bake dependencies into the image. Watch the logs while you test. It\u0026rsquo;s the only way to really trust failover. Still to do: the Proxmox node fails over only if the host or keepalived stops. If Technitium crashes on its own, keepalived keeps the VIP. Adding the same chk_dns health check there, and dropping its priority from 255 (a special \u0026ldquo;address owner\u0026rdquo; value health checks can\u0026rsquo;t lower) to 110, will fix that. ","date":"1 December 2026","externalUrl":null,"permalink":"/posts/technitium-ha-keepalived/","section":"Posts","summary":"","title":"Highly available DNS at home: two Technitium servers behind one keepalived VIP","type":"posts"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/homelab/","section":"Tags","summary":"","title":"Homelab","type":"tags"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/keepalived/","section":"Tags","summary":"","title":"Keepalived","type":"tags"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/posts/","section":"Posts","summary":"","title":"Posts","type":"posts"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/proxmox/","section":"Tags","summary":"","title":"Proxmox","type":"tags"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/qnap/","section":"Tags","summary":"","title":"Qnap","type":"tags"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/technitium/","section":"Tags","summary":"","title":"Technitium","type":"tags"},{"content":"","date":"1 December 2026","externalUrl":null,"permalink":"/tags/vrrp/","section":"Tags","summary":"","title":"Vrrp","type":"tags"},{"content":"","externalUrl":null,"permalink":"/authors/","section":"Authors","summary":"","title":"Authors","type":"authors"},{"content":"","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"}]