DNS .lxd tutorial - .lxd domain won't resolve

Hi again!

I attempted to follow @simos tutorial on getting .lxd working on Debian Sid. I’m using the snap.

I cannot get even the temporary solution to work.

Relevant information, everything I’ve tried and errors:

$ host test.lxd
Host test.lxd not found: 3(NXDOMAIN)

$ host test.lxd 10.111.89.7
# longish wait
;; connection timed out; no servers could be reached

$ lxc network list
+----------------+----------+---------+-------------+---------+
|      NAME      |   TYPE   | MANAGED | DESCRIPTION | USED BY |
+----------------+----------+---------+-------------+---------+
| docker0        | bridge   | NO      |             | 0       |
+----------------+----------+---------+-------------+---------+
| enp0s31f6      | physical | NO      |             | 0       |
+----------------+----------+---------+-------------+---------+
| lxdbr0         | bridge   | YES     |             | 4       |
+----------------+----------+---------+-------------+---------+
| wlp2s0         | physical | NO      |             | 0       |
+----------------+----------+---------+-------------+---------+
| wwp0s20f0u2i12 | physical | NO      |             | 0       |
+----------------+----------+---------+-------------+---------+

$ lxc network list-aliases lxdbr0
+----------+-------------------+-------------+---------+
| HOSTNAME |    MAC ADDRESS    | IP ADDRESS  |  TYPE   |
+----------+-------------------+-------------+---------+
| test     | 00:16:3e:96:cc:c3 | 10.111.89.7 | DYNAMIC |
+----------+-------------------+-------------+---------+

$ systemd-resolve --status lxdbr0
Link 19 (lxdbr0)
      Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
DefaultRoute setting: yes
       LLMNR setting: yes
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: allow-downgrade
    DNSSEC supported: yes
  Current DNS Server: 10.111.89.1
         DNS Servers: 10.111.89.1
          DNS Domain: lxd

$ ping 10.111.89.1
PING 10.111.89.1 (10.111.89.1) 56(84) bytes of data.
64 bytes from 10.111.89.1: icmp_seq=1 ttl=64 time=0.039 ms

$ ip addr show dev lxdbr0
    19: lxdbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fe:3b:b0:69:b5:6e brd ff:ff:ff:ff:ff:ff
    inet 10.111.89.1/24 scope global lxdbr0
       valid_lft forever preferred_lft forever
    inet6 fd42:31f7:5a44:75d5::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::b027:c1ff:fe12:2b5e/64 scope link 
       valid_lft forever preferred_lft forever

$ sudo systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-resolved.service.d
           └─resolvconf.conf
   Active: active (running) since Sat 2019-02-09 13:34:39 AEDT; 10min ago
     Docs: man:systemd-resolved.service(8)
           https://www.freedesktop.org/wiki/Software/systemd/resolved
           https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
           https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
  Process: 8345 ExecStartPost=/bin/sh -c [ ! -e /run/resolvconf/enable-updates ] || echo "nameserver 127.0.0.53" | /sbin/resolvconf -a systemd-resolved (code=exited, status=0/SUCCESS)
 Main PID: 8344 (systemd-resolve)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   Memory: 2.3M
   CGroup: /system.slice/systemd-resolved.service
           └─8344 /lib/systemd/systemd-resolved

Feb 09 13:34:39 styler-debian systemd[1]: Starting Network Name Resolution...
Feb 09 13:34:39 styler-debian systemd-resolved[8344]: Positive Trust Anchors:
Feb 09 13:34:39 styler-debian systemd-resolved[8344]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
Feb 09 13:34:39 styler-debian systemd-resolved[8344]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Feb 09 13:34:39 styler-debian systemd-resolved[8344]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in-addr.arpa 31.172.in-addr.arpa 168.192.in-addr.arpa d.f.ip6.arpa corp home internal intranet lan local private test
Feb 09 13:34:39 styler-debian systemd-resolved[8344]: Using system hostname 'styler-debian'.
Feb 09 13:34:39 styler-debian systemd[1]: Started Network Name Resolution.

$ systemctl | grep lxd
  sys-devices-virtual-net-lxdbr0.device                                                                      loaded active plugged   /sys/devices/virtual/net/lxdbr0                                              
  sys-subsystem-net-devices-lxdbr0.device                                                                    loaded active plugged   /sys/subsystem/net/devices/lxdbr0                                            
  run-snapd-ns-lxd.mnt.mount                                                                                 loaded active mounted   /run/snapd/ns/lxd.mnt                                                        
  snap-lxd-9919.mount                                                                                        loaded active mounted   Mount unit for lxd, revision 9919                                            
  lxd-host-dns.service                                                                                       loaded active exited    LXD host DNS service                                                         
  snap.lxd.daemon.service                                                                                    loaded active running   Service for snap application lxd.daemon                                      
  snap.lxd.daemon.unix.socket                                                                                loaded active running   Socket unix for snap application lxd.daemon     

$ sudo lsof -i -n | grep domain
dnsmasq    7521             lxd    8u  IPv4 328115      0t0  UDP 10.111.89.1:domain 
dnsmasq    7521             lxd    9u  IPv4 328116      0t0  TCP 10.111.89.1:domain (LISTEN)
dnsmasq    7521             lxd   10u  IPv6 328117      0t0  UDP [fe80::b027:c1ff:fe12:2b5e]:domain 
dnsmasq    7521             lxd   11u  IPv6 328118      0t0  TCP [fe80::b027:c1ff:fe12:2b5e]:domain (LISTEN)
dnsmasq    7521             lxd   12u  IPv6 328119      0t0  UDP [fd42:31f7:5a44:75d5::1]:domain 
dnsmasq    7521             lxd   13u  IPv6 328120      0t0  TCP [fd42:31f7:5a44:75d5::1]:domain (LISTEN)
systemd-r  8344 systemd-resolve   17u  IPv4 342687      0t0  UDP 127.0.0.53:domain 
systemd-r  8344 systemd-resolve   18u  IPv4 342688      0t0  TCP 127.0.0.53:domain (LISTEN)

I used How to access container alex as alex.lxd from host? a lot to try and debug.

Hello fosslinux. I am the alex who wrote the alex.lxd post you mentioned.

Now please check this (newer) post of mine: A way to resolve container.lxd from host, in all cases

It contains what I see as a “perfect solution” which is simple and works everytime everywhere. I use that and am happy.

Disclaimer: The solution might very well not be perfect, since I’m not at all an expert on Linux networking.