So, if I understood your question, you have:
- 2 PCs on internal networks.
- You have no influence on the routers on either network.
And you want to:
- Set up a public server (PS) hosting an SSH service (I assume port 22).
- Connect PC1 and PC2 to PS (Outgoing traffic, no router config).
- Connect a VNC session from PC2 (Windows) to PC1 (Ubuntu) on port 5900.
You can achieve that by creating an SSH tunnel, doing a remote forwarding from PC1 and a local forwarding from PC2.
This would be the architecture:
So to get this working, from the Ubuntu PC, PC1, you need to connect to PS using:
ssh <ps-user>@<ps-address> -R 5901:localhost:5900
At this point if you logged into the PC1 you may run
netstat -latn | grep 5901 and you should see it listening. This means that one half of the process is ready.
Now the client connection. From PC2, if it was a linux box too, you might use
ssh <ps-user>@<ps-address> -L 5902:localhost:5901
if it is Windows, you can use PuTTY, by setting the port forwarding section below
Tunnels, and add a Local port with Source port
5902 and destination
localhost:5901. When clicking add you will see in the list of forwarded ports something like
Now you have two tunnels connected to a public server. If you run VNC viewer from PC2 and point to localhost:5902, you should connect to the VNC service listening on port 5900 on PC1.
Hope it helps.