How to reach containers using their name from the host?

I like the fact that I can reach containers by their name when communicating from within containers on the same bridge.

This does not seem possible directly from the host, though. Using resolvectl, I can make some settings that do allow me to reach containers with {containername}.incus.

sudo resolvectl dns incusbr0 {ip address of incusbr0}
sudo resolvectl domain incusbr0 '~incus'

For the love of me, I can’t figure out how to persist these settings without taking ownership of the whole interface.

I see that @simos wrote an article a few years back how to do this with LXD on Ubuntu 18.04. I was wondering if these instructions are still valid in 2025 with Ubuntu 24. Or if there are better approaches available now.

using unbound:
cat /etc/unbound/unbound.conf
include: “/etc/unbound/resolvconf.conf”
server:
verbosity: 0
module-config: “respip validator iterator”
interface: 127.0.0.53
interface: ::1
prefer-ip4: yes
prefer-ip6: no
tls-system-cert: yes
hide-identity: yes
hide-version: yes
port: 53
do-ip4: yes
do-ip6: no
do-udp: yes
do-tcp: yes
tls-cert-bundle: “/etc/ssl/certs/ca-certificates.crt”
trust-anchor-file: trusted-key.key
include: /etc/unbound/ads/enabled.conf
root-hints: “/etc/unbound/root.hints”
prefetch-key: yes
cache-min-ttl: 3600
cache-max-ttl: 86400
prefetch: yes
num-threads: 2
harden-dnssec-stripped: yes
harden-glue: yes
use-caps-for-id: no
edns-buffer-size: 1232
private-domain: “intranet”
private-domain: “internal”
private-domain: “private”
private-domain: “corp”
private-domain: “home”
private-domain: “lan”
private-domain: “incus”
domain-insecure: “incus”
unblock-lan-zones: yes
insecure-lan-zones: yes
domain-insecure: “intranet”
domain-insecure: “internal”
domain-insecure: “private”
domain-insecure: “corp”
domain-insecure: “home”
domain-insecure: “lan”

forward-zone:
name: “incus”
forward-first: yes
forward-addr: 10.84.9.1 # incus bridge dns address

forward-zone:

name: “.”

# forward-first: yes

forward-addr: 1.0.0.1

forward-addr: 8.8.4.4

forward-addr: 1.1.1.1

forward-addr: 8.8.8.8