Local Win+Ubuntu: ssh from Win to Ubuntu via the Internet

Solution 1:

The easiest way to do it is leaving the SSH and VNC servers on the systems on default settings, and separate them with the port forwarding. Having multiple systems using the same port in the same network does not cause conflicts, as the systems are only listening on the port, and clients connect using the IP address.

From within the network you use the internal IPs, let's assume 192.168.0.10 for Ubuntu. To SSH from Windows to Ubuntu you ssh [email protected]. Get the internal connectivity working correctly before thinking about external access.

For connecting from outside you need to configure port forwarding on the router, for example 10010. By what you describe I'd configure port forwarding thus:

Device IP: 192.168.0.10
Starting port: 22
Ending port: 22
Remote IP: blank
Remote port: 10010

Then you should be able to SSH from outside to Ubuntu ssh user@<PublicIP> -p 10010.

The default port for VNC is 5900+N, N being the display number - usually it's 0 so port 5900 is enough. You can allow access to the Ubuntu with VNC by creating a similar port forwarding rules. For example you could use 10590 as the remote port and 5900 for Starting and Ending port. The VNC client will then connect to the internal system using the public IP and remote port.

To test the access from outside you need to actually access from outside. One way is connecting a system to the internet using a phone hotspot instead of the router; it won't be in the same internal network anymore.

Note that for port forwarding to be reliable you should configure your Ubuntu system with a static IP address.

This is just general advice based no the available info. Exact implementation advice can't be given without exact details.