brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: unbound-control flush and flush_zone drop cached DNS answers

Network and access
~/tips/tip-unbound-control-flush-zone

unbound-control flush www.example.com

Removes one name, or a whole zone, from the Unbound cache so it is looked up again.

Unbound caches answers, which is the point. But after you fix a record, the old answer can hang around until its TTL runs out. You can throw it out of the cache yourself.

unbound-control flush www.example.com
unbound-control flush_zone example.com

As the man page describes it, flush removes one name from the cache. It covers the types A, AAAA, NS, SOA, CNAME, DNAME, MX, PTR, SRV, NAPTR, SVCB and HTTPS. For another record type there is flush_type name type. flush_zone removes everything at or below the name, so a zone and all its subdomains.

It only works when the remote control is set up. The man page says to run unbound-control-setup as the Unbound user (sudo -u unbound unbound-control-setup) or as root, and then turn on control-enable in unbound.conf.

The caveat: the docs call flush_zone a slow operation, because it has to walk and inspect the whole cache. For a single hostname, use flush. With serve-expired enabled, the zone entries are only set to expired, and Unbound serves them while it schedules a fresh lookup.

The man page lists related commands. flush_negative removes all negative data (NXDOMAIN, NODATA, SERVFAIL), which helps after a record you just added was cached as missing. flush_bogus removes all bogus data, and flush_infra all empties the whole infra cache. Adding +c also clears cachedb items, if cachedb is in use.

Further reading: Unbound docs: unbound-control

Going deeper: Guide: AdGuard Home with Unbound: resolve DNS yourself instead of asking Cloudflare or your ISP

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link