I am trying to connect from my laptop (with Linux Mint) to my remote desktop (with Linux Mint too) using VNC Viewer on my laptop and x11vnc on my desktop. I manage to connect if I am on the same network but if I try to connect to x11vnc from a different network, it doesn't work, staying stuck in "Connecting to 192.168.x.x" window. How could I solve? Thanks in advance!
192.168.x.x is a private address. This means it is only accessible from within your internal network.
In order to connect from an external network, you will need to grab the external address of your network. There are a number of ways to do this, but the easiest is to simply type "what's my IP" into a search engine from your internal network, which will either directly show this or give you a website that will.
You may also need to set up port forwarding to forward the traffic from your external connection to the internal machine you are attempting to connect to.
While your laptop and desktop are in the same network they have IP addresses in the same subnet, for example 192.168.1.0/24. They can communicate directly with each other. As soon as you move the laptop's IP interface to a different subnet, for example 192.168.2.0/24, you need a router to forward the traffic between subnets.
If you're trying this over the internet, you can't VNC to 192.168.x.x at all, unless you configure a VPN connection to your intranet. This is a private IP range used literally in millions of networks, therefore cannot be routed over the internet.
To access the desktop with VNC over the internet you need to configure your router to forward incoming VNC traffic towards the desktop. Most often this is in router settings called "Port Forwarding", and VNC by default uses port 5900. After this you can open a VNC session using your router's public IP address and it will connect to the desktop.
How to configure Port Forwarding is explained in your router's User Guide.
For future reference... because addresses in 192.168.0.0/16 range (192.168.0.0 - 192.168.255.255) are private IPs, there's no point obfuscating them in this context. As long as you keep your router's public IP to yourself, they can't really be used to compromise your network.
If you wan't connect to a different network there are a view options:
- Use of routing, proxy, etc..
- Add a new ip with the network you will communicate to you interface
/etc/network/interfaces(if host is on the same location)
- Use your router and config a port forwarding
- create a remote port forwarding with ssh
- make use of vpn