I am working on scripting a way to flush dns cache on different linux distros. I want to support doing this with Ubuntu-server, Ubuntu-desktop, Centos8-desktop, and Centos7-server(nogui)
I have built 4 vms of each.
For ubuntu its easy. I can just run sudo systemd-resolve --flush-caches
and that does the trick.
However for the centos distros I cant seem to find a way to accomplish clearing the cache or even understanding how DNS is working. What I have read online is that for centos/rhel I can use either dnsmasq
or nscd
based off this link, but my results are different...
On the centos8 box, I found the dnsmasq
service was stopped and disabled after deployment. Trying to start service gave an error that port 53 was taken. I looked up ss -tulpn
and found that port 53 was taken by virb0 interface, which is apart of libvirtd
. IT seems kvm is installed by default in centos8 stream? Either way I am curious how dns / caching even works with this service enabled. How do I clear a cache on a centos host that has libvirtd enabled?
On the cnetos7 box, I found no dnsmasq
or nscd
service. So I am kind of puzzled how dns caching even works at all?
How can I determine how dns is cached on the centos8 and centos7 hosts. How do I look at the current dns cache? and how do I clear the cache?
Note I have two nameserver
configured in my /etc/resolve
on each centos box.