14

How do you SSH between two different networks? Thanks in advance. Here is the scenario in question:

  • My home PC IP : 192.168.1.106
  • Home public IP: XXX.YYY.ZZZ.254
  • My office PC IP: 192.168.10.130
  • Office public IP: XXX.YYY.ZZZ.160

How do I can SSH from 192.168.1.106 (my home) to 192.168.10.130 (office) or vice versa? Is this possible? Please help me.

15

This is possible if you have port forwarding on a receiving router. For instance, if you want to ssh from office back to home, you need to go into home router settings first, and set up port forwarding for port 22 to a specific IP address on your home network and port number, in your case 192.168.1.106 port 22. That way if you do from office ssh user@XXX.YYY.ZZZ.254 , you will be redirected from router to your home computer.

Settings for port forwarding differ form router to router; just to get a feel for it, look at the examples in the How To Forward Ports on Your Router article

With office, it may be difficult because it depends on your company and typically IT would say no, but you might want to ask them

1
  • Its working!!!.Thank you very much for your valuable help. Mar 25 '16 at 9:39
2

You need a public facing port to connect to.

A good solution is NGROK , search "TCP tunnel" you want ngrok tcp 22.

It exposes the port to its own temporary domain name that is public facing. ngrok is free, though the free users have their domain reset when ngrok closes. Putting the computer to sleep doesn't close down ngrok. Just don't close down ngrok and you should be fine.

The other option I have done is to buy a host, (domain optional) (I use digitalocean, and namesilo), then use tinc to vpn my home computer, my server, and my laptop with my server as the host and the other two computers as clients. I then ssh to my server, then I can ssh to my other computer.

0
2

Use port forwarding on your router configuring for sample all entering traffic through ports 20 to 29 be redirected to the internal IP address with the same ports.

Additionally to this you may consider an external dynamic DNS service such as dyn.com (formerly dyndns.com) or noip.com.

0

Yes, it is absolutely possible. You typically use port forwarding for that (for different residential routers, the way you do port forwarding may vary). There is one problem with it, however. Most Internet service providers will not allow you to do that. So, probably you will not be able to access your home computer from work. Remote login over the Internet is almost always means that you're going to have to contact your ISP to tell them that you want this feature enabled which most likely will cost you additional money. At least, that was the case with me when I wanted to get access to my computer at home from work.

For additional information on how to properly set up port forwarding, just look on YouTube.

0

This happens due to the retail routers having a default setting of only allowing ICMP and blocking others (such as Telnet, SSH, HTTP, HTTPS), especially on GPON Gateways. The solution can be achieved in two steps which need to be performed on the router of your SSH Server:

  1. Type in 192.168.1.X in your browser (X being the serial of the router, generally X=1). This opens the login page. The default passkey and username is 'admin'. Go to the Security settings, go to the "Access Control" sub-menu and enable "Allow" for SSH under WAN (if you use Wifi to SSH into the target machine via the router) and under LAN (if you use Ethernet to SSH into the target machine via the router).

  2. Next, more to Application Settings and choose the Post Forwarding menu. Now on the browser you will see a lot of fields. One of them must be "Applications", which is a drop down menu and choose SSH Server. Next in the "Internet Client" drop down menu choose the device/machine from list of devices connected to the router into which you want to SSH. Click on Add.

You can add multiple devices in this manner. In that case, you will have to explicitly specify the device from the SSH Client.

For example lets say, you have added three devices: Dev A: 192.168.1.2 Dev B: 192.168.1.3 Deb C: 192.168.1.4

So if you want to SSH into Dev B you must enter the following command:

ssh usernameofDevB@AAA.BBB.CCC.XXX

where AAA.BBB.CCC.XXX is the public IP displayed by the router.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.