when a qemu builder is configured to run with default virbr0 network bridge, ssh is trying to connect using 127.0.0.1 instead of guest ip.
2022/08/17 17:52:50 packer-builder-qemu plugin: Executing /usr/libexec/qemu-system-x86_64: []string{"-boot", "c", "-m", "16384M", "-name", "ubuntu_cloudimg_2204", "-
netdev", "bridge,id=user.0,br=virbr0", "-device", "vfio-pci,sysfsdev=/sys/bus/mdev/devices/0ce43357-a523-4eb5-8014-1c9a23a7bba4,multifunction=on", "-device", "virtio-net$
netdev=user.0", "-uuid", "4df60d2a-96c8-407e-837b-cbf29075f9d0", "-qmp", "unix:ubuntu_cloudimg_2204-qemu/ubuntu_cloudimg_2204.monitor,server,nowait", "-machine$
, "type=pc,accel=kvm", "-drive", "file=ubuntu_cloudimg_2204-qemu/ubuntu_cloudimg_2204,if=virtio,cache=writeback,discard=ignore,format=qcow2", "-vnc", "0.0.0.0:$
6"}
==> qemu.ubuntu_cloudimg_2204_qemu: Overriding defaults Qemu arguments with QemuArgs...
2022/08/17 17:52:50 packer-builder-qemu plugin: Started Qemu. Pid: 2368270
2022/08/17 17:52:52 packer-builder-qemu plugin: Qemu stderr: qemu-system-x86_64: -device vfio-pci,sysfsdev=/sys/bus/mdev/devices/0ce43357-a523-4eb5-8014-1c9a23a7bba4,mul$
ifunction=on: warning: vfio 0ce43357-a523-4eb5-8014-1c9a23a7bba4: Could not enable error recovery for the device
==> qemu.ubuntu_cloudimg_2204_qemu: QMP socket at: ubuntu_cloudimg_2204-qemu/ubuntu_cloudimg_2204.monitor
2022/08/17 17:52:52 packer-builder-qemu plugin: QMP socket open SUCCESS
==> qemu.ubuntu_cloudimg_2204_qemu: Waiting 3s for boot...
==> qemu.ubuntu_cloudimg_2204_qemu: Connecting to VM via VNC (0.0.0.0:5986)
2022/08/17 17:52:55 packer-builder-qemu plugin: Connected to VNC desktop: QEMU (ubuntu_cloudimg_2204)
==> qemu.ubuntu_cloudimg_2204_qemu: Typing the boot command over VNC...
==> qemu.ubuntu_cloudimg_2204_qemu: Waiting for the guest address to become available in the virbr0 network bridge...
2022/08/17 17:53:05 packer-builder-qemu plugin: Found guest address 192.168.122.76
2022/08/17 17:53:05 packer-builder-qemu plugin: Using host value: 127.0.0.1
==> qemu.ubuntu_cloudimg_2204_qemu: Using ssh communicator to connect: 127.0.0.1
2022/08/17 17:53:05 packer-builder-qemu plugin: [INFO] Waiting for SSH, up to timeout: 1h0m0s
2022/08/17 17:53:05 packer-builder-qemu plugin: Using host value: 127.0.0.1
2022/08/17 17:53:05 packer-builder-qemu plugin: [INFO] Attempting SSH connection to 127.0.0.1:22...
from above logs would asume ssh to connect to guest vm via guest ip instead of localhost:22, are there any settings that does this already ?
I have tried skip_nat_mapping
flag as well and still the same behaviour