How can I SSH into home computer from internet

9,687

Solution 1

Most of the time, Network Address Translations(NAT) is done internally by home routers. Your D-link router should be able to handle the translation automatically, however you need to open/forward the port number that the ssh-server is running on. If you have ssh-server running on a pc with netID 192.168.1.2:PortNumber, then you open the PortNumber coming in from Outside for ip 192.168.1.2. Check the specs for on your Dlink router for ways to accomplish port forwarding. As for fixing your dynamic IP address issue, you might want to use free services offered by no-ip, afraid etc ... so you can resolve your dynamic/changing ip address by using there free dns name.

Solution 2

What you can do is set up your SSH on 192.168.1.2 to listen on another port. Usually, you do this by editing sshd.conf or sshd_config, say, port 1022.

And when you run ssh, do it like so,

ssh -p 1022 DynamicIP

where DynamicIP is the IP assigned by your ISP.

You need to set up your router to forward port 1022 to 192.168.1.2.

If you're on Windows, consider using putty as the SSH client.

Solution 3

Simplest way to do that might be ngrok: https://ngrok.com/

Ngrok tunnels through any firewall, and sets up a publicly accessible (dynamic, or static) subdomain to either HTTP, or even direct TCP connections. Incantations:

ngrok tcp 22

-> assigns 0.tcp.ngrok.io:19778 which stays open until the application runs. Paid versions can also reserve a TCP address, so you can put ngrok into eg. init.d to have it auto-started, and memorize only one single address, regardless what your ISP assigns to you.

Once assigned, you can connect to it via ssh:

ssh -p 19778 0.tcp.ngrok.io

Share:
9,687
user61954
Author by

user61954

Updated on September 18, 2022

Comments

  • user61954
    user61954 over 1 year

    I have a setup like follows

    1. I have a router that connects to the INTERNET, where my ISP provides dynamic ip
    2. two systems are connected to the router with locl ip 192.168.1.2 and 192.168.1.3
    3. the local ip of the router is 192.168.1.1

    My question is how can I access the computer with ip 192.168.1.2 from the Internet when I know the ip assigned by the ISP

    My Dlink router has a field for NAT which is as follows enter image description here

    I have SSH enabled in the 192.168.1.2 system as well as the router. When I filled the entries in the NAT table and tries to connect to the 192.168.1.2 system it still connects to the router only

    The values I gave re server name: 192.168.1.2 , protocol tcp and all other port values as ssh port 22. When I gave like that it showed message that router port moved to 2222, but that port is not open when i checked using nmap