Add vlans inside LXD.


I have an LXD container running inside an Ubuntu 16. I would add some vlans inside that container and expose it to the other machines on the network.

But when I try to reach the container from a VM it does not work. Is there any configuration I can do to get around this problem.
Note. These vlans inside the container are created automatically by the system. There may be more than 30 vlans within this container.

LXD config

environment.http_proxy: “”
user.network_mode: link-local
description: COS profile
name: eth0
nictype: bridged
parent: br0
type: nic
name: cos
used_by: []

I would create the bridge configuration on the LXD host itself and create an LXD profile for each of the vlans, then attach the profile which has the vlan that you need to the container

I asked the client about this solution. But the client application uses the Vlan inside the container.

What you’re describing should be fine. VLAN tags will be passed to the containers and containers can then create VLAN interfaces inside them.

So eth0 on the host is bridged in br0, containers are bridged into br0 and then VLAN interfaces are created on top of eth0 inside the containers.

Note that the kernel will filter out all VLAN tags from the host’s eth0 if any VLAN device is created on top of it. So bridging eth0 into br0 is fine so long as you don’t also have an eth0.100 or similar on the host.