Published On: July 5, 2019|Categories: Linux|Tags: , , , , |

LXD is a fantastic container virtualization tool that comes by default with Ubuntu. In one of my applications I needed to have many containers each within it’s own VLAN network.
So I used OpenVSwitch in combination with LXD to achieve this.

There is no inherent facility in LXD to provide VLAN tag numbers to the interface. So it is necessary to use a “Fake bridge”. I managed to do it after reading this article by Scott – VLANs with Open vSwitch Fake Bridges

Let’s say the OpenVSwitch bridge is named vm-bridge and we want to add 10 fake bridges ranging from VLAN 20 to 30. Here’s how I did it:

In LXD you can specify the bridge to which it will connect containers to, so I created 10 containers using a similar loop 😀
Further to bind each container to the fake bridge this step is needed:


  1. bmullan September 12, 2019 at 1:37 AM - Reply

    Could you show more of the LXD side of this? For instance how you create the LXD containers so they each get their own assigned VLAN?


    • nilesh September 12, 2019 at 3:07 PM

      You have to create them like you would create a normal one using lxc launch command then use the lxc config set command I have specified in the post.


This site uses Akismet to reduce spam. Learn how your comment data is processed.