I'm running a qemu VM in user networking mode and I'd like to be able to access forwarded ports from the host. Something like the following works well.

-netdev user,id=t0,hostfwd=tcp::9992-:9992 

But my VM makes an internal bridge network and I'd like to be able to access IPs from within that network. According to the documentation, the following should work but there's definitely something missing

-netdev user,id=t0,hostfwd=tcp:

After adding a network alias for virbr0 or lo (sudo ifconfig virbr0 add that host and port may respond to the netcat utility, but I'm having trouble contacting the services on the other side.

Is what I'm attempting possible? Here's my full invocation:

/usr/bin/qemu-system-x86_64 \
-smp 1 \
-m 1024 \
-uuid 6780dc39-da5f-4dda-844c-59f81b1a3c4c \
-pidfile cfdev-efi-state/qemu.pid \
-enable-kvm \
-machine q35,accel=kvm:tcg \
-object rng-random,id=rng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=rng0 \
-drive file=cfdev-efi-state/disk.img,format=qcow2,index=0,media=disk \
-boot d \
-cdrom cfdev-efi.iso \
-drive if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd \
-device virtio-net-pci,netdev=t0,mac=52:7a:c1:64:44:26 \
-netdev user,id=t0,hostfwd=tcp::9992-:9992,hostfwd=tcp::9999-:9999,hostfwd=tcp:,hostfwd=tcp:,hostfwd=tcp:,hostfwd=tcp: \

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.