I usually show how to re-use libvirt’s bridge for lxc networking. And since generally I have libvirt installed anyway, it’s what I usually do. But if you don’t want to use libvirt, no big deal.
If you’re using a wired network, you can instead place that NIC on a bridge, and add your container NICs to the same bridge.
In this short post I’ll show how to bridge to a (non-wireless) NIC. In the next, longer post, I’ll show how to make your own NATed bridge to a wireless NIC.
If eth0 is the wired NIC and uses dhcp, you can use the following in /etc/network/interfaces to move it into a bridge:
auto eth0 iface eth0 inet static address 0.0.0.0 auto br0 iface br0 inet dhcp bridge_ports eth0
Then your /etc/lxc.conf would read:
Now you can proceed with the usual container creation and management. Note that now the containers are not NATed or behind the host’s firewall (until you configure it so), which may be not as safe.