Is it possible to isolate a network bridge from the host system?

I am afraid google has failed me this time. And i have never been too good with this sort of network configuration.

So what i am trying to do.
I have a motherboard with 2 gigabit nic’s. I want to use one of them for the host system and dedicate the other to a qemu vm. Ideally i would like to just pass one strait through but as they are both in the same iommu group that’s not an option. So i think my only option is to bridge one.

I have created a bridge via /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

iface enp6s0 inet manual

auto br0
iface br0 inet dhcp
    bridge_ports    enp6s0
    bridge_stp      off
    bridge_maxwait  0
    bridge_fd       0

And i pass that bridge to the vm with the following argument
-device e1000,netdev=net0,mac=52:54:00:3f:3c:de -netdev tap,id=net0
Im not exactly clear on how that works but it does.

The issue is the host system also has access to the bridge which i dont want.
So is there a way i can isolate the bridge interface from the host?
Or is there a better way i can handle this?

I’m sure this script could be adapted to network bridges

https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Script_variants

Some of that does look like it could be useful but it looks like that mostly focuses on pci passthrough. I dont see anything about network configuration there.

Have you tried the ACS override? Does it cause problems?

Just because devices are in the same IOMMU group doesn’t mean they use PCIe P2P signalling.

Set the bridge interface to manual instead of dhcp then the host system won’t get an ip for that interface. This doesn’t affect the VM, that will have its own network configuration for the interface

You also don’t need to use macvtap for bridge interfaces, only for physical interfaces. You should be able to assign the bridge to a vm once the bridge is configured.

2 Likes

Have you tried the ACS override? Does it cause problems?

Im on x399 and the nics run through the chipset so i have a feeling acso wont help.
I would prefer to avoid it anyway.

Set the bridge interface to manual instead of dhcp

See now this is one of the reasons i hate network configuration… I already tried that yesterday and it didn’t work. The VM could not get an IP. But today it magically works. I guess the restart i did since them may have fixed something.

I have also been fiddling with my script and found a simpler net argument
-nic bridge,model=e1000,br=br0 \
But foe some reason that does not let me define a custom mac so for now im using
-netdev bridge,br=br0,id=n1 -device e1000,netdev=n1,mac=52:54:98:76:c4:32

Somewhat unrelated. After setting up the network bridge the host’s network became extremely unstable freezing every few minutes. But im pretty sure this is entirely caused by my OPNSense router. My network wasn’t particularly stable to start with because for some reason OBNSense does not play nice with my 4G modem. And bypassing my router has fixed all stability issues.
Just thought i would mention this in case someone here has experience with issues like this.

1 Like

Here’s a blog post describing isolation (basically you need vlan filtering if you want to keep a bridge isolated from the host.

Here’s another post that explains macvlan and macvtap and how they differ from a bridge