Linux bridge within VM instance?

dj423

Member
Oct 10, 2023
98
30
18
Im sure I am doing something wrong, but is it possible to run a normal linux bridge within a Proxmox VM running Debian 11?

I am running my Proxmox node on a trunk port, with vlan aware bridge, and I put the VLAN tag on the VM network interfaces to separate the traffic. I also have vmbr0.99 for the management interface on the Proxmox node. All works fine.

I run test LXD containers in a Debian 11 VM, and when I setup a bridge it works initially, then a few minutes later I lose all connectivity to the gateway for some reason.

Here is the bridge config from within the VM:

Code:
auto br0
iface br0 inet static
        address 192.168.50.228
        broadcast 192.168.50.255
        netmask 255.255.255.0
        gateway 192.168.50.1
        dns-nameservers 192.168.50.1
        bridge_ports eth0
        bridge_stp off       # disable Spanning Tree Protocol
        bridge_waitport 0    # no delay before a port becomes available
        bridge_fd 0          # no forwarding delay

I have tried removing the "50-cloud-init" file with no luck. I have installed bridge-utils and the bridge shows up, just no traffic to or from the gateway. Do I need to put the VLAN tag on the bridge perhaps? If I figure it out, I will share the solution.
 
When you specify a VLAN tag in the vNIC configuration the Ethernet frames arrive untagged (without VLAN info) in the VM. No need to add a VLAN interface inside the VM.
We have been running bridges in VMs for quite some time. So generally this is possible.
 
  • Like
Reactions: dj423
When you specify a VLAN tag in the vNIC configuration the Ethernet frames arrive untagged (without VLAN info) in the VM. No need to add a VLAN interface inside the VM.
We have been running bridges in VMs for quite some time. So generally this is possible.
Ok cool, that's sort of what I was thinking. Thanks for the sanity check! I will try and review my steps. I notice eth0 has the same address as the bridge, so I must have missed a step in my configuration.
 
Well I lucked out. It was just some cloud-init files getting in my way. I wound up needing to remove two files in /etc/udev/rules.d

Code:
/etc/udev/rules.d/70-persistent-net.rules
/etc/udev/rules.d/75-cloud-ifupdown.rules

Needed to remove these to stop eth0 from getting a DHCP address. I can smooth this process out by feeding cloud-init the bridge config at initialization so I won't have to clean these up moving forward.
 
  • Like
Reactions: gurubert