Succeeded (?) in setting-up DNS on Ubuntu Desktop with snap LXD

My problem was that on Ubuntu Desktop 18.04, and with LXD installed from snap, I could not get this command to work:

$ host my-container-name.lxd

…because my-container-name.lxd wouldn’t resolve.

I found this solution to my problem:

  1. edit /etc/NetworkManager/NetworkManager.conf, and in the section [main] add this line:
    dns=dnsmasq
    (I believe this line says that systemd-resolved.service will not be used anymore)

  2. remove the file /etc/resolv.conf

  3. execute systemctl restart NetworkManager

  4. Run ifconfig to find the IP address of lxdbr0 (suppose for now that it is 10.8.7.1)

  5. create or edit the file /etc/NetworkManager/dnsmasq.d/lxd.conf, and insert this line:
    server=/lxd/10.8.7.1
    (replace the number 10.8.7.1 with whatever you found in step 4)

  6. Reboot the PC

Do you see something bad in this solution? Do you think it could cause problems to my computer?

Thanks

Hi!

I cannot test this at the moment. What it does though, is that it replaces systemd-resolved with dnsmasq. Not clear if that is LXD’s dnsmasq (would be not recommended because you set your host’s DNS to be that of your LXD’s).

If you check my updated blog post, it should have an updated solution based on a discussion from this forum I did not try that solution so you can give it a go.

@simos, I wrote a comment about this here: Ubuntu 18.04 infinite Loop dnsmasq systemd-resolved