May 18, 2018

LXC Bridge to LAN


  • Ubuntu 16.04
  • LXC/D installed
  • Working eth0

Install utilities

sudo apt install lxc bridge-utils

Bridge your interface

Edit config

sudo nano /etc/network/interfaces
Set eth0 to manual
Add section for br0 (or whatever you'd like to label the bridge)
Make sure you include eth0 (or your interface name) so it comes up with the bridge


auto br0
iface br0 inet dhcp
    bridge-ifaces eth0
    bridge-ports eth0
    up ifconfig eth0 up

iface eth0 inet manual

Bring the interface up:

sudo ifup br0

Configure LXC to use the bridge

lxc profile edit default

Change networking:

parent: lxcbr0
to 'br0' from above.

Modify the LXC default using sed (optional)

sudo apt install lxc
sed -i 's/ = lxcbr0/ = br0/' /etc/lxc/default.conf