K
K
Konstantin Dolinin2014-09-18 12:40:12
linux
Konstantin Dolinin, 2014-09-18 12:40:12

Reverse SSH, external connection. How?

There are two computers connected to the Network via LTE modems (that is, they are located behind the operator's NAT), I am sitting at the first one, the second one is at home. There is an OpenVZ virtual machine with a white IP belonging to some example.org. On the home computer, a reverse SSH tunnel was opened with the command from root:

/usr/bin/ssh -f -N -R 2124:192.168.0.1:22 [email protected]
When I go from my computer to and then from its interface I go to , I find myself on my home computer. But when I try to go there right away , I getssh [email protected]ssh [email protected] -p 2124ssh [email protected] -p 2124
ssh: connect to host example.org port 2124: Connection refused
Where did I go wrong in the setting?
PS I learned about reverse SSH yesterday.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Dolinin, 2014-09-18
@kostett

A. Understood, it seems. OpenVZ does not imply a working NAT, so what is on the localhost does not necessarily look external. It's time to move to KVM.
And if you are too lazy to move, then:
In general, I, as usual, forgot to think. -A - authorization forwarding.

P
PLed76, 2014-09-25
@PLed76

-R 2124:192.168.0.1:22
Here port 2124 is exposed to the internal interface only. It is necessary to write with an external address. For example, if the external address is 8.8.8.8, then:
-R 8.8.8.8:2124:192.168.0.1:22

S
Sergey, 2014-09-18
@bk0011m

Well, it says, "Connection refused" - which means either the port is closed or there is no route.
You first connect to one host on port 22, and then go from it to the second host on port 2124

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question