How to add a network interface in lxc?

If it’s LXD, then you’ll want something like:

lxc config device add CONTAINER-NAME eth1 nic name=eth1 nictype=bridged parent=lxdbr0

If it’s LXC, then edit /var/lib/lxc/CONTAINER-NAME/config and duplicate the existing set of lxc.network entries for your second network interface (changed the device name and possibly the bridge).

5 Likes