Libvirt with VM on specific Vlan

Hello everyone,

I have a Unifi network set up with several Networks aka Vlans. They are configured like this:

I have a server with only one Ethernet network interface, and its IP is 192.168.2.4 on the “Servers” network (Vlan 2).
I also have several VM running with libvirt with their network adapter creating using virtio drivers and bridge to the bro interface.
And finally br0 is managed by NixOS to bridge everything to my physical network interface like following:

{ ... }:
{
  # Cf https://github.com/NixOS/nixpkgs/issues/198267
  networking.bridges.br0.interfaces = [ "enp6s0" ];
  networking.interfaces.br0.useDHCP = true;
  networking.dhcpcd.extraConfig = ''
    interface br0

  '';
}

Currently, the host is reachable on 192.168.2.4 and all VMs have a IP assigned on the Vlan 2 aswell. They are visible from the Unifi interface which is very handy to manage them.

It think you understand where I’m going. I’d like my host to be still reachable through 192.168.2.4 but all the VM’s to be on the 192.168.6.1/24 and still show up in the Unifi interface as discrete devices.

Do you have any idea on how I can do that?

NB: This is a request for both help for NixOS configurations and explanations about how the network stack works. I feel lost by a lot of words and technical stuff, and sadly I don’t have time to go down the rabbit hole to learn everything about it. :frowning:
But I would love to understand how it can work :slight_smile: