Setup vlans inside LXD

lxd

#1

The setup is simple:

I am moving some client services into an LXD 3.0 container under Ubuntu 18.04. Among the services are some vlans created on one NIC.

The setup is:
LXD 3.0 container --> Ubuntu 18.04 server --> switch --> local lan

The ubuntu 18.04 server provides DHCP, DNS, NTP, services for the local lan.

I tried using a physical NIC mapping (ens2f2 to peth0) onto the container and the services worked. I then a tried adding vlans onto peth0 like peth0.10 for the 10.0.10.x subnet, peth0.20 for the 10.0.20.x subnet but these didn’t work.

What am I doing wrong or is there any other way I can achieve this?


#2

My setup has multiple NICs.

If I setup one NIC as a nictype=physical, would it then be possible for me to create vlans on the container directly from the NIC. It is visible into the container as eth0, so can I do eth0.10, eth0.11 as vlans?

I have tried this and it hasn’t worked. Anyone with experience in this or how best I can set it up?


(Stéphane Graber) #3

Yeah, creating VLANs on a physical interface inside the container is perfectly fine and works as you’d expect.


#4

Let me try this and get back to you