I need your advice.

Brief to my question:

I got two Linux/Ubuntu 18.04 Lts. machines. First one is the host(SSHD) and has a VM machine installed on it(virtual machine's ethernet is configured as NAT: Qemu/KVM - virtualization). Simple SSH connection between host and VM on it in NAT regime works perfectly: ssh [email protected] > pass

First machine is connected to router via LAN and second machine is a ssh-client connected to a router via Wifi.

machine1(host machine, LAN) > Router < (wifi) machine2(SSH Client)

Is there any solution to access VM(on host machine) with machine that is connected to wifi network only? I'm pretty new with Unix/Linux, so I would really appreciate your support with this case.

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.122.x netmask broadcast

P.S. I would prefer not to switch NAT to bridge regime. If you need more data, I will gladly provide you with some more details.

  • 1
    You need to configure port forwarding on machine1, e.g. port 2222 forwarded to port 22 on the VM guest. There should be various ways to implement it, including adding a netfilter rule with the iptables command. Since this is a common requirement, you will find plenty of tutorials on the internet. Alternatively, it might also be possible to create a route to the VM's address on machine2, with machine1 as router. Apr 18, 2021 at 13:59

2 Answers 2


If you can ssh to the physical host from your client, and to the VM from the physical host, then simply....

ssh -J [email protected] [email protected]

(alternatively create a ssh_config for vm.example.com with the ProxyJump set to phys.example.com)


If you have KVM Manager (GUI), you can follow this guide with no issues. The process is the same: VMware Workstation port-forwading

You must log in to answer this question.

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