Lxd container ipfire 2 nics


I understand we now can run virtual machines inside lxd. Now i run a virtual machine (kvm) with ipfire with 2 nics.

Is it possible to migrate this to lxd virtual machine? how can i handle this? where to start?

kind regards,


I’m not super familiar with IPfire but looking at it, it looks like it can run on UEFI with secure boot disabled. If your existing VM is already using UEFI, you could move the disk as is but as it’s unlikely to be, a reinstallation followed by copying your configuration is likely easiest.

For that, you’d create an empty LXD VM and then install IPfire on it with:

  • lxc init ipfire --empty --vm -c limits.cpu=2 -c limits.memory=4GiB -c security.secureboot=false
  • lxc config device override ipfire root size=50GiB
  • lxc config device add ipfire install disk source=/path/to/installation/iso/file
  • lxc config device add ipfire eth0 nic nictype=bridged name=eth0 parent=br0
  • lxc config device add ipfire eth1 nic nictype=bridged name=eth1 parent=br1
  • lxc start ipfire --console=vga

This will create an empty VM that has 2 vCPU and 4GB of RAM as well as secureboot disabled.
It will then grow the disk from the default 10GB to 50GB (not sure how much IPfire needs).
Then you add the two NICs (this will vary based on your setup).
And lastly you start the VM with the VGA console attached so you can go through the install.

Once installed, stop the VM and do lxc config device remove ipfire install to detach the install media.

Hope that helps!

Hi @stgraber

You help me allot. However one more question. Ik now have 2 Nics in bridge mode on my Debian host. Can i add the network bridges directly to the vm?

i think i got it.

However can i also do the install with a vnc client? --vga is not working. i have a headless server.

You can get the output of the console from a headless LXD server by using a remote lxc client.

Hi Thomas

How can i achive this. If u do lxc start ipfire console and font het any input (no graphical) i am ussing SSH putty

You can use a machine that isn’t headless to connect to a headless server running LXD.


lxc console myremote:<my instance> --type=vga

so i have to install a machine with lxd on it to connect to the remote?

if i do this on a remote machine that has a desktop i get the following error

unable to init server: Could not connect: Connection refused
(remote-viewer:6333): Gtk-Warning **: 18:23:07.460: cannot open display:

allredeay worked for me.

how can we backup a lxd vm. is a lxc export enough?
and since the virtual machine runs on lxd can i remove the kvm packages?

Btw i want to give you al my compliments on lxd.

@stgraber @tomp you guys are doing a great job. I love lxd and dont wont to use other virtualization any more!

kind regards chris.


If you are using the snap package of LXD then that includes the required QEMU software and doesn’t need external KVM packages.

You can export an instance to a file using lxc export <instance> <file name> and then reimport it later using lxc import <file name>.


how can i add ram and hdd space to an excisting lxd vm machine?

In both cases, you’ll want to shut it down first.
For memory, you do: lxc config set NAME limits.memory=4GiB
For disk, it’s either of those (depending on whether you’ve already changed it):

  • lxc config device override NAME root size=20GiB
  • lxc config set NAME root size=20GiB

Note that for disk, if you’re not using an image which has cloud-init baked in, you’ll need to manually grow your partitions after the fact. This can usually be done with a tool called growpart that you can install on most distros.

  • growpart /dev/sda 2
  • resize2fs /dev/sda2

Image that include cloud-init will do that automatically for you on boot.