Bridged VM networking setup

We’re unsucessfully trying to create a bridged networking setup for VMs.

Help would be much appreciated

One difficulty seems to be that the host has a static IP:

We’ve tried a few suggestions from various forums such as:

networking = {

    interfaces.br0.ipv4.addresses = [
      {
        address = "192.168.0.122";
        prefixLength = 24;
      }
    ];

   bridges = {
      br0 = {
        interfaces = [
          "eth0"
          "virbr0"
        ];
      };
    };
...
}

This leaves us with no br0 device and no connectivity.

We tried using a DHCP-based setup:

networking = {
    interfaces.eth0.useDHCP = true;
    interfaces.br0.useDHCP = true;

   bridges = {
      br0 = {
        interfaces = [
          "eth0"
          "virbr0"
        ];
      };
    };
...
}

Now br0 is created, but no interface gets an IP. (We verified that eth0 gets an IP if we don’t specify a bridge.)

Here’s a post that I read through and used.

Ah, it takes an explicit useDHCP = false;- even though there’s a static IP.

Many thanks for the link!