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?


2 Answers 2


I solved it:

iptables -t nat -I PREROUTING -p tcp -d --dport 8834 -j DNAT --to-destination

iptables -I FORWARD -m state -d --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.

  • Thanks, but can you please explain that for a dummy?
    – Fabs
    Commented Aug 16, 2018 at 9:36
  • Sorry, I am not a developer but a simple user. There is more branches to be explained: NAT, kvm-qemu, listening on a port ... I cannot guess what is to be explained. You can use either the CLI command or GUI to configure and start the Virtual Machine. For both ways you can find many examples on the internet, on serverfault.com, too, e.g.: (serverfault.com/questions/704294)
    – schweik
    Commented Aug 17, 2018 at 9:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .