1

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

2 Answers 2

2

I 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
1

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.

2
  • Thanks, but can you please explain that for a dummy?
    – Fabs
    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
    Aug 17, 2018 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.