[lxc-users] Is it possible nested LXC-libvirt containers?

Serge Hallyn serge.hallyn at ubuntu.com
Wed Apr 30 13:28:28 UTC 2014


Quoting Daniel P. Berrange (berrange at redhat.com):
> On Wed, Apr 30, 2014 at 09:01:56AM -0400, CDR wrote:
> > I need to provide NAT networking to my LXC containers, much like using
> > virbr0 from libvirt, except that nesting a libvirt-lxc container does
> > not work. So if I nest a pure LXC container, which is supported, how
> > would you create a bridge that would nat-forward the packets to the
> > network?
> > I am sure it is possible, but it escapes me.
> 
> Well you could replicate what libvirt does with virbr0 - which is basically
> just create a bare bridge device and setup iptables rules for forwarding

Right, which lxc in ubuntu gratefully borrowed from libvirt, so you can
also look at https://github.com/lxc/lxc/blob/master/config/init/upstart/lxc-net.conf

> and masquerading. Or you could just tell lxc tools to connect the container
> to the virbr0 device that libvirt already provided.

right that's what we used to do as well, works perfectly fine.  So just
install libvirt and set

lxc.network.type = veth
lxc.network.link = virbr0


More information about the lxc-users mailing list