DNS is very slow to lookup container dns names when not connected to the internet

I have a system which is offline and runs 3 lxd container.

These three containers should talk to each other via the name.
Which works, but takes forever.

Pinging the ips directly takes ~0.007s and
pinging the dns name works but takes 15sec.

Any idea how to configure the dnsmasq started with lxd to respond faster?
Is there a way to get logs from this dnsmasq server?

Please can you show lxc network show <network>, and ip a and ip r on the host and inside each container.

Please can you also show the DNS resolution IPs being set inside the instances.

I made some progress i didn’t attache ip a and ip r from the container.
The routing seems fine using ip addresses is not an issue.

And as you can see from my network config it’s the default config.

image

Except for the raw.dnsmasq. This option is a workaround.
The problem is the systemd-resolved on the host which takes forever to fail,
and only then the lxd dnsmasq uses the internal info.

Which I don’t really understand why does dnsmasq for internal hostsnames check upstream dns server instead of returning the internal mapping?

For anyone stumbling over this issue the problem in my case was a Debian Buster image without a DHCP client installed.

Which leads to a failed systemd-network.service which can be fixed by installing a DHCP client (isc-dhcp-server) and restart the service.