How to force flush of DNS cache?

Hi,

Using VyOS 1.1.7, it still cache the negative response for a domain over a day after it was changed.

I tried to restart dnsmasq (using sudo /etc/init.d/dnsmasq restart as well as stop followed by start) but it still keeps the cached negative response.

I also tried to set the cache size to 0 using set service dns forwarding cache-size 0 and committing the change then restarting dnsmasq but still it fails to resolve the updated hostname.

Querying, for instance, Google’s 8.8.8.8 returns the updated response.

What else can I do?

Thanks.

Use nslookup to VyOS upstream DNS server, to verify it’s handing out the correct addresses

Normally, dnsmasq restart ( sudo service dnsmasq restart ) should be enough to flush its cache

Thanks. That must be it. My DNS server now returns the correct results but I’ll try to keep this in mind next time.

I’m sorry for bringing it up so late, but i have a small question which might be related:
Our Vyos worked great until recently, when suddenly, in the middle of nowhere, it stops pinging external websites like google.com
Didn’t try and ping the IP, but… our Vyos does have a DNS-Forwarding service.

Basically, after a reboot? => all works like a charm.
I’m trying to understand if it might be DNS related problem.
The cache-size we currently have on that DNS is 150.

Can it be that somewhere along the way, when the cache is full, Vyos will stop resolving addresses?.
Any other ideas on what can be done to try and understand why vyos suddenly stops pinging “outside world”. Do note that all Interfaces are up, and Vyos can ping its default gateway and everything looks good.

Thank you.

Today I needed to know how to force flush the DNS cache on VyOS so I googled and found this thread first. I read the answers provided and felt like they were not the best answer. I found this afterwards, just run:

reset dns forwarding all
or
reset dns forwarding example.com
to clear cache for a certain domain only

2 Likes