How to correctly setup bridged network on Debian 12 for qemu?

Hello,

I am trying to setup bridged network for qemu VMs, but can’t make to work it correctly.

  • if i setup bridged network via network manager (nmtui), qemu guest VM cannot obtain an IP:

    • /etc/NetworkManager/system-connections/Wired connection 2.nmconnection:

          [connection]
          id=Wired connection 2
          uuid=<uuid>
          type=ethernet
          interface-name=enp3s0
      
          [ethernet]
      
          [ipv4]
          method=auto
      
          [ipv6]
          addr-gen-mode=default
          method=auto
      
          [proxy]
      
    • /etc/NetworkManager/system-connections/enp3s0.nmconnection i created via nmtui

          [connection]
          id=enp3s0
          uuid=<uuid>
          type=ethernet
          interface-name=enp3s0
          master=<uuid>
          slave-type=bridge
      
          [ethernet]
      
          [bridge-port]
      
  • If I setup bridged network via /etc/network/interfaces.d/ it does work in both host and guest vm (internet access work fine), but in host system:

    • Network manager DE GUI show " no connection"

      Screenshotfrom2023-10-0712-22-54.png.63514e95b8a4d73cb3295a351fecacf8

    • pc is connected to internet via bridged network br0 (and as result do not receive static IP configured for enp3s0 MAC-addresse.

    • enp3s0 interface is listed as unmanaged

    • /etc/network/interfaces.d/br0 (created via cli)

          ## DHCP ip config file for br0 ##
          auto br0
           
          # Bridge setup
           iface br0 inet dhcp
              bridge_ports enp3s0
      

How is possible to create bridged interface working in qemu guest systems and host system connection stay managed and show up in Network Manager DE GUI?

  • Start nmtui
  • delete your wired network connection
  • create network bridge
  • add networkadapter to networkbridge
  • save and quit (after that you should have a connection on your host)
  • launch virt-manager
  • select your qemunode and go to network settings
  • delete the default network
  • create network with your networkbridge and hit the start button
  • tick the auto start checkbox and hit save
  • select your networkbridge in your vms settingspage as your source
1 Like