12

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.

9

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

  • Its working!!!.Thank you very much for your valuable help. – Dinesh Dhananjayan 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.

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.

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.