Trunk interface for LXC. Possible?

pocok

Well-Known Member
Dec 6, 2019
34
15
48
Hello,

My current config consists of an LC OVS Bridge (vmbr0) with is trunked. All the VMs, LXCs have interfaces connected to this bridge and of course each of them have a VLAN ID specified.

Now, a situation has arised where I would need a trunk port, basically just L2, to be available within an LXC container. I would have assumed that there would be no special configuration, if I would ommit the VLAN ID for the containers' network interface configuration it would work. However in this situation the interface would not be brought up automatically (this in an LXC container with a Debian image). Is there some additional configuration needed to be done within the container network settings, or on the Proxmox hosts, or currently forwarding a trunk port for an LXC is not possible?

Thank You,
 
  • Like
Reactions: smprston162
Just wanted to say, that I also would like to know if this is possible.
As it turns out, it is possible - you just need a little low-level LXC configuration. From the LXC documentation:

lxc.net.0.flags
Specify an action to do for the network.

up: activates the interface. [/I]
...Where 0 is an interface identifier. Since proxmox reserves identifiers 0-9, you can use those to reference it in your config.
Working example:
Code:
# ...
net1: name=trunk0,bridge=vmbr2,hwaddr=xxxx,type=veth
lxc.net.1.flags: up

There is also another not so well documented option in the proxmox `pct config`:
trunks=<vlanid[;vlanid...]>
VLAN ids to pass through the interface
[\QUOTE]
Which can be used to pass multiple (trunks=1;2;3;4;5)/all (trunks=0) VLAN IDs through on the interface (It's in the LXC documentation I believe, not exactly where).

For a working example:
Code:
net0: name=intranet0,bridge=vmbr2,gw=192.168.5.1,hwaddr=xxxx,ip=192.168.5.2/24,trunks=0,type=veth
or:
Code:
net0: name=intranet0,bridge=vmbr2,gw=192.168.5.1,hwaddr=xxxx,ip=192.168.5.2/24,trunks=1;2;3;4;5,type=veth
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!