BIND and Intermittent DNS issues

Hello -

I’m having some issues with my DNS sometimes resolving specific hosts, and sometimes not.

What I have is a server with a static IP Address running Virtualmin where I have my primary domain. At home, I have another server that has a static IP address. I have created a cronjob that will use the external API of Virtualmin to connect to my main server and delete the A record of the hosts that are on my home server and recreate them (in case my home IP changes).

The 2 issues I am having are:

  1. Occasionally I get a duplicate A record for the hosts that the API creates. When the API runs and deletes the record the next time it will delete both and then create only one record again and then randomly it will create a second.

  2. This is the biggest issue - Sometimes the hosts do not resolve at all. I changed the trusted ACL to any and the issues still occur. If I dig the host, sometimes it will display the A record, and sometimes it won’t. I currently have two hosts on my home server. It will sometimes display an Answer and other times it will only display Authority.

$ dig host1.website.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.2 <<>> host1.website.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 724
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;host1.website.com. IN A

;; AUTHORITY SECTION:
website.com. 1799 IN SOA ns1.website.com. root.ns1.website.com. 1426996621 10800 3600 604800 38400

;; Query time: 48 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Sat May 2 19:44:59 2015
;; MSG SIZE rcvd: 82

When I did this same command 5 minutes ago:

$ dig host1.website.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.2 <<>> host1.website.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22662
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;host1.website.com. IN A

;; ANSWER SECTION:
host1.website.com. 377 IN A 12.34.56.78

;; Query time: 24 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Sat May 2 19:33:09 2015
;; MSG SIZE rcvd: 53

I currently have Google’s DNS servers setup as forwarders. The dig command is being ran from the server that hosts the DNS. It does the same if I run it from my home server.

Edit: My TTL for the A records hosted on my dynamic IP is 10 minutes and the cron to check and update them runs every 8 minutes. I also had that at 10 and 10 before.