DNS cache not automatically updating

This support forum board is for support questions relating to Nagios Network Analyzer, our network traffic and bandwidth analysis solution.
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: DNS cache not automatically updating

Post by solarmon »

OK, I let another hour past and I see this time that the DNS cache entry has updated without me doing anything. I think because the TTL is 1 hour it must have overlapped or something.

So I think the fix for me was to swap the entries in /etc/cron.d/nagiosna to make the 'cache' one appear first.

To verify this, I will swap it back (and restart crond) and make the DNS change again and see if that changes by itself (after at least 2 hours).

I have the following CentOS version:

CentOS Linux release 7.6.1810 (Core)
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: DNS cache not automatically updating

Post by tgriep »

I would update crond on the system just in case it is a bug in the cron daemon.
Be sure to check out our Knowledgebase for helpful articles and solutions!
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: DNS cache not automatically updating

Post by solarmon »

OK, I reverted the crontab file and strangely it is still working - and it is still appearing in the log file.

I had to wait two hours for it to update on NNA but I think there are a few factors at play.

There is a local DNS cache on system that honours the TTL timeout of 1 hour. The NNA DNS lookup seems to also be using this local cache too. So it does not get updated if that local DNS cache does not get updated - so that is why it could be until the second attempt when it next gets updated.

If it was a new DNS entry then this might not be the same issue, but the test I did was to change an existing DNS entry.

So it does seem to be working now, after changes and restarts to crond, and I just need to be aware of the TTL and local DNS cache also.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: DNS cache not automatically updating

Post by tgriep »

It makes no sense that cron would run one entry but not the other. At least it is working now.
Let us know if it is OK to lock up the post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
solarmon
Posts: 81
Joined: Fri Sep 13, 2019 3:57 am

Re: DNS cache not automatically updating

Post by solarmon »

Yes, it doesn't make sense, but I definitely did not see the entry in the cron logs. Maybe a restarted of the crond service fixed it, but I did do that previously too.

It seems to be working as expected right now. although with the local DNS cache issue. Is this local DNS cache expected? Or are you expecting the DNS lookup to not be cached?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: DNS cache not automatically updating

Post by tgriep »

Most systems I have encountered, do not use a local DNS cache, the system is setup to use the DNS servers directly to get the updated DNS entries.
If you do not want to have the delay, disable the caching DNS server and setup the system to use the DNS servers directly.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked