How to enable lxc network on debian jessie?

The LXC packages in Ubuntu ships enable LXC networking properly. This is basically done by a init script called lxc-net which setups the lxcbr0 bridge and a number of iptables rule to set up networking. In this post I describe how to use network in debian jessie.(Debian Jessie ships with an updated version of LXC 1.06 but does not set up the LXC networking by default)

First download the lxc-net script here and follow the instructions below.

apt-get install lxc dnsmasq-base bridge-utils
touch /etc/default/lxc
echo 'USE_LXC_BRIDGE="true"' > /etc/default/lxc
cp lxc-net /etc/init.d/
chmod +x /etc/init.d/lxc-net
systemctl enable lxc-net
systemctl start lxc-net
systemctl status lxc-net

To ensure containers created have the lxcbr0 bridge enabled by default add the config below to /etc/lxc/default.conf = veth = lxcbr0 = up = 00:16:3e:xx:xx:xx

Previous post: How to install jekyll?

Next post: Headless Selenium Testing With Python and PhantomJS