Hi,
is there a way to flush dns cache? I used to restart kresd but now it seems to keep its cache.
Best regards,
Edouard
Hi,
is there a way to flush dns cache? I used to restart kresd but now it seems to keep its cache.
Best regards,
Edouard
dunno what version OS you have, but worth quick check: Proposal: keep / preserve kresd dns cache after restart (via config option)
Yes, there’s now that option. Router restart also flushes the cache, as it’s in /tmp/
(to save the flash storage).
I found this in /etc/config/resolver:
config resolver 'kresd'
...
option keep_cache '0'
...
is that correct ?
Yes, that seems correct.
Thanks a lot vcunat
so while you can hard code that setting in the configuration, I find it more useful to be able to flush the cache by hand, as a one-time thing. Turns out this is simple:
# socat - /tmp/kresd/tty/*
> cache.clear()
true
> ^C
In other words, start the daemon by hand in interactive mode (without -f
) and call the cache.clear()
function. Other functions are available to do more fine-grained changes but in my experience they often return “error: Function not implemented” so I’m not sure what’s up with that.
Sending the command to the running instance seems better than starting yet another one. https://doc.turris.cz/doc/en/public/dns_knot_misc#interactive_command_console
BTW, knot-resolver >= 3.0.0 supports more fine-grained cache-clearing, but that version is not in stable Omnia ATM https://knot-resolver.readthedocs.io/en/stable/daemon.html#c.cache.clear
aaah that’s how you talk to a running kresd. i couldn’t find that in the documentation. i’ve updated my answer accordingly.
It’s here in upstream docs (not the best place arguably). The default setup depends on packaging a bit, especially location of the unix socket.
right. i’ve sent a pull request to improve the docs slightly. it would be great to have a standard commandline tool that would just know where that socket is…
There actually is an early prototype of command-line tool for this socket (with tab completion), but we decided to abandon it and do it in a different way in future, in particular to be able to better handle multiple kresd instances at once. Omnia doesn’t package the prototype tool; most distros don’t.
since a recent upgrade, this changed to:
socat - /tmp/kresd/control/*