I'm trying to get libvirt to port forward to guests without fussing too much with static IP assignments. I found this question with an interesting answer here.
The XML section of relevance:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> . . . </devices> <qemu:commandline> <qemu:arg value='-netdev'/> <qemu:arg value='user,id=mynet.0,net=10.0.10.0/24,hostfwd=tcp::22222-:22,hostfwd=tcp::8000-:8000'/> <qemu:arg value='-device'/> <qemu:arg value='e1000,netdev=mynet.0'/> </qemu:commandline> </domain>
I copy the additional parameters section (after making sure xmlns is defined). I see that qemu-system now listens to the specified ports.
However, trying to e.g. ssh via those ports does nothing. Connection is simply reset after some half a minute.
I tried tinkering with the settings, but nothing seems to do much good: the host is listening to the specified port, but when that port is used, the packets don't go anywhere.
I have verified with tcpdump utility that this actually doesn't work - there are no packets when I attempt to ssh into the guest.
How can I get port forwarding to work WITHOUT resorting to static IP addresses and IPTABLES?