There is a newer version of steps I use when setting up LXD, Bind, and Virtualmin to make Bind and LXD play nicely together. It includes the steps here and in addition a new step that wasn't required before but now seems required.

It took me a while to figure out why I couldn't get LXD and lxc containers working with a system running Virtualmin.

The problem occurred like this:

  1. Virtualmin is installed and running with all services enabled.
  2. LXD is installed on the same machine. lxd init is run, creating the bridge interface (Bind has to be stopped to successfully install LXD)
  3. A new container can be created with lxc launch ubuntu:18.04 test
  4. Container works fine
  5. System is rebooted and container doesn't get an IP address (IPv4 or IPv6) any more.

The problems occur when a system is used as both a Virtualmin host and an LXD container host because Virtualmin installs Bind (a nameserver) by default and LXD requires dnsmasq by default. The problem is because Bind and dnsmasq both use port 53.

I wrote this for my own reference. If you need any clarifications just ask and I'd be happy to give more explanation or answer questions.

The solution is simple. Just tell Bind to only listen on the main network interface and not the bridge interface (lxdbr0) created by LXD.

When my /etc/bind/named.conf.options file was edited so that it said the following everything worked fine and bind and dnsmasq worked together in harmony.


    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { 
        fe80::21d:42wf:fefe:bc7a;  # The IPV6 address on the main internet facing network interface
        };
    listen-on port 53 {
        105.215.118.13;   # The IPV4 address on the main internet facing network interface
        };
};

 

In the past, I have disablied the Bind service when installing LXD. Now I will simply set up the /etc/bind/named.conf.options file to specify only listening on the main network interface. That way there will be no address conflict on the bridge interface (lxdbr0) created by LXD.