I have a setup like below: qemu as hypervisor. ubuntu running as a virtual machine with two network adapters:
- eth0: connected to a user network.
- ssh port is forwarded to a port from host OS.
- eth1: connected to a tap network that is on default NAT bridge of libvirt.
what I want to do is to be able to ssh from outside of the host to the vm using forwarded port:
- ssh username@host_ip -p forwarded_port
however, ssh command is getting timeout.
I am able to ssh from the host to the vm using forwarded port:
- ssh username@localhost -p forwarded_port
interestingly enought, when I remove the second interface that is connected to NAT network, I am able to ssh to the server from outside. so I know for sure that firewall is not blocking anything.
what am I doing wrong? is it something related to ssh or the network?
EDIT: I figured when I set the nat interface down, ssh from outside is working.
ip route
priorities on your guest to make eth0's gateway the preferred default gateway.