2

I have 2 machines, A and B. Both of them are connected to their own wifi access point (routers). Both the wifi routers are connected to the same private LAN, like a university's intranet.

A's router has its public IP on the private LAN as 10.20.30.40 and B's router has the IP 10.20.30.50. Both A and B have their private IPs (wrt router) as 192.168.0.100. Its obvious that more than 1 machine may be connected to each router, hence the solution should still allow this.

How do I ssh from A into B ?

How do I set up a simple P2P connection between the 2 machines?

Also if there is a 2nd machine on B's router, say C, how do I ssh to it from B? How do I ssh it from A, while simultaneously ssh-ing to B but from a different terminal window ?

2
  • By "a simple P2P connection", do you mean something different from ssh asked about in the previous sentence? If so, what?
    – bertieb
    Aug 30, 2015 at 10:46
  • Try something like a client and echo-server using P2P
    – Codi
    Aug 31, 2015 at 11:54

2 Answers 2

0

First thing you need to do is forward the ssh port (22 by default) on the server side so that when an incoming request on the router arrives, it will forward the request to the appropriate destination.

Then ssh to the public IP of the router (where the ssh server is connected).

In simple words, forward port 22 to the IP of your computer B on the router it is connected to. And use public IP of the router to connect to ssh.

0

What is the device that provides connection to both routers?

Use a different local IP range for your router clients so they don't conflict with other devices of the shared network.

Then, if both A and B can ping each others Local IP, then it works the regular way without any port forwarding.

ssh user@local-ip

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .