How to connect to remote computer with public and local ip?

10,071

Solution 1

Ok then,

Remote PC:

sudo apt-get install openssh-server

Optional: For better security change the default SSH port.

 sudo vim /etc/ssh/sshd_config

Search for

# Port 22

Edit it to:

Port XXXX

where XXXX is the new port number.

Once this is done, login to the remote router (not your router but the router on the remote network). Apply port-forwarding. It something like
Trigger port XXXX for ip address {remote LOCAL ip address (something like 192.168.0.100)}

Once you set up the remote connection go to your PC and type:

ssh {public ip address} -p XXXX -l username

For instance:

ssh 98.123.211.111 -p 1414 -l root

You will be asked to enter the user's password and once you do that you will have remote connection to the desired address.

NOTE: You can trigger different ports in order to connect to different PCs on the remote network.

Solution 2


Could you please specify the operating systems on the computers ?

Linux: You can connect to the computer via ssh.
There are some conditions: - The computer, that you want to connect to, must have installed openssh-server.
- There must be port-forwarding for the local IP address, in order to type ssh {Public IP ADDR} -p {Port number (default is 22)} if you want to connect to the remote PC.

Also you can establish remote desktop connection.
Remote Desktop requires TCP port 3389 to be open.

If you need more information about setting up the remote connection, please let me know and I will help you.

Share:
10,071
Kyrylo Romantsov
Author by

Kyrylo Romantsov

Symfony and Magento developer.

Updated on September 18, 2022

Comments

  • Kyrylo Romantsov
    Kyrylo Romantsov almost 2 years

    I have all credentials of the computer in remote computer network consisting of several computers. I know it's local name and ip, also user and pass. And public ip of this network.

  • Kyrylo Romantsov
    Kyrylo Romantsov over 6 years
    Ubuntu is on both computers