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: run unbound-checkconf before you restart Unbound

Unbound
~/tips/tip-dns-unbound-checkconf

unbound-checkconf /etc/unbound/unbound.conf

Checks an Unbound config file for errors before you restart the resolver.

A typo in unbound.conf can take down name resolution for the whole house if Unbound refuses to start. Checking the file first takes a second.

Unbound ships a checker. The manual describes it as checking the configuration file for syntax and other errors:

unbound-checkconf /etc/unbound/unbound.conf

Without a file name it checks the config at the default location. It exits with status 0 for a correct file and 1 on an error, which makes it easy to chain. The -q flag suppresses output on success:

unbound-checkconf -q && sudo systemctl restart unbound

The restart then only happens when the check passes. A broken file leaves the running Unbound alone and prints the error.

The -o flag is useful too. After checking, it prints the value of one option, so you can confirm which value Unbound reads from the file. For an interface setting:

unbound-checkconf -o interface /etc/unbound/unbound.conf

The manual adds that an option that is disabled prints an empty line, and -f prints the full path name with chroot applied, for use with -o.

The caveat: the config path differs per install, and a container may keep the file somewhere else, so give the path explicitly and run the command in the container that runs Unbound. The check covers syntax and similar errors in the file. It does not test whether your upstream servers are reachable.

Further reading: unbound-checkconf manual

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

More Unbound tips prefetch: yes unbound-control cache_lookup example.com All Unbound tips (3) All topics

Link