DNS not working when offline

Hi!

I’m running HA as docker image and since ever I noticed that certain devices, e.g. my UPS via nut integration does not deliver values during the night when I turn of my Internet connection. I traced it down to a DNS resolving issue which I do not understand.
To be on the safe side I installed dnsmasq and set my internal DNS server:

[16:17:59] INFO: Configuring dnsmasq...
[16:17:59] INFO: Starting dnsmasq...
dnsmasq[6]: started, version 2.80 cachesize 150
dnsmasq[6]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC loop-detect inotify dumpfile
dnsmasq[6]: using nameserver 192.168.110.1#53
dnsmasq[6]: cleared cache

When I log into the container everything is fine (kvm.lan is the host that runs upsd):

~ $ ping kvm.lan
PING kvm.lan (192.168.110.5): 56 data bytes
64 bytes from 192.168.110.5: seq=0 ttl=63 time=0.447 ms
64 bytes from 192.168.110.5: seq=1 ttl=63 time=0.370 ms
--- kvm.lan ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.370/0.408/0.447 ms

~ $ dig kvm.lan
; <<>> DiG 9.14.12 <<>> kvm.lan
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56123
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;kvm.lan.			IN	A

;; ANSWER SECTION:
kvm.lan.		5	IN	A	192.168.110.5

;; Query time: 5 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Sun Jul 19 16:11:59 CEST 2020
;; MSG SIZE  rcvd: 52

When I turn off the Internet connection it takes some time but then it gets strange. Ping stops working:

~ $ ping kvm.lan
ping: bad address 'kvm.lan'

The DNS of the container cannot resolve the address any more:

~ $ dig kvm.lan

; <<>> DiG 9.14.12 <<>> kvm.lan
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 52586
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: d1426e27e7f4d858 (echoed)
;; QUESTION SECTION:
;kvm.lan.			IN	A

although my configured (internal) DNS does answer without issues:

~ $ dig kvm.lan @192.168.110.1

; <<>> DiG 9.14.12 <<>> kvm.lan @192.168.110.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55099
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;kvm.lan.			IN	A

;; ANSWER SECTION:
kvm.lan.		0	IN	A	192.168.110.5

;; Query time: 1 msec
;; SERVER: 192.168.110.1#53(192.168.110.1)
;; WHEN: Sun Jul 19 16:27:19 CEST 2020
;; MSG SIZE  rcvd: 52

Does anyone have good ideas on that? Why does dnsmasq (of the container) not answer although I configured only one upstream DNS which obviously does answer? I had a look at other posts with similar issues but couldn’t find a solution and some are already quite old.
Here is my setup if that helps tracing down the issue:

arch x86_64
chassis vm
dev false
docker true
docker_version 19.03.8
hassio true
host_os Debian GNU/Linux 10 (buster)
installation_type Home Assistant Supervised
os_name Linux
os_version 5.4.0-0.bpo.2-amd64
python_version 3.7.7
supervisor 229
timezone Europe/Vienna
version 0.112.4
virtualenv false

I have a few further issues when being offline (mainly GUI) but I would like to go one by one and continuously getting values from my sensors has highest priority.

Thanks a lot,
Patrick

In case someone has a similar problem, there is a post that says

Don’t use a DNS block rule on our firewall if you are not a Company with a network department. Just forward that to your internal DNS server.

I now instantiated such a redirect and it made things more smooth, but I’m still not convinced that HA really works offline/without Internet as I see numerous errors from different integrations.