How can I ssh into an ubuntu guest - running on a win10 host - from a remote linux server?

Solution 1:

This is usually called a "double NAT" situation when you're behind a router. You have to forward from the border router to the Windows system, and then forward in VBox to the VM. You might also have to forward port 22 from the actual network connection to the VBox NAT adapter, but I'm not as clear on that for Windows.

Ultimately, though, there's at most three things you'll have to do here. They're all in Windows, or not in Ubuntu Linux, so most of your answers will be on Super User or elsewhere.

  1. (If you are behind a router on your network that Win10 is on) Set up Port Forwarding on your router on the network to forward Port 22 to your Windows 10 system.

  2. Set Windows Firewall to allow connections inbound on Port 22. You may also need to specify that you want Port 22 to be forwarded from your inbound network adapter to the NAT network on the VM network settings.

  3. Set the NAT forwarding rule on the NAT network in VirtualBox to forward Port 22 on the host to Port 22 on the VM.

A slightly more nicer approach that sort of bypasses Step 2 and Step 3 here is to use Bridged Mode in the VM network settings; this will then get an IP from the same network as the Windows 10 system is connected to, and you can then port forward port 22 at the edge router (step #1) to the IP assigned by the network to the VM itself. This is a little less painful than having to do multiple hops and configurations to get Port 22 working.

NOTE: Some ISPs filter Port 22 so Port 22 traffic won't reach the system; you may have to set up a higher port than Port 22 (such as 2022 or another nonstandard port >1024) instead if this is the case.


As for finding the guest's IP, that info will be in the output of ifconfig -a or ip -4 addr list in the Linux guest. That's the easiest part out of all of this, because this will be the same, Bridged or NAT.

Solution 2:

You'll need to set port forwarding in Windows 10 VM player

You'll need to set external port on Windows 10 machine, which will be forward to the service port on the virtual machine in the NAT network.

This link explain how to do it