i have Ubuntu 18.04 with KVM and a Debian VM. The Debian VM should accept the port 8834 from outside. Can anyone explain me how it should works?
Thanks
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityI solved it:
iptables -t nat -I PREROUTING -p tcp -d 192.168.137.71 --dport 8834 -j DNAT --to-destination 192.168.122.31:8834
iptables -I FORWARD -m state -d 192.168.122.0/24 --state NEW,RELATED,ESTABLISHED -j ACCEPT
service netfilter-persistent save
Just look into the qemu-doc.html
in /usr/share/doc...
and follow the example: -net user,hostfwd=tcp::8834-:8834,
. This suppose you are using the most simple network definition: -net nic, ... -net user, ...
. Even if you do not configure any application in the guest system, in the host system you can immediately see the listen port with e.g. netstat
.