ssh: подключиться к хост-порту 22: соединение отказано

5171
Michael

Я пытаюсь подключиться к моей новой Raspberry Pi с помощью MobaXterm, но получаю следующую ошибку: ssh: подключиться к хосту ... порт 22: соединение отказано.
И ПК, и Raspberry Pi имеют проводные соединения с маршрутизатором, и я могу успешно пропинговать Raspberry Pi. У меня тоже такая же проблема с Putty.

Чтобы проверить мое соединение, я также попытался войти в суперкомпьютер на работе через MobaXterm, но он возвращает ту же ошибку. Я точно знаю, что ssh работает на этом компьютере, так как я могу подключиться к нему с моего рабочего компьютера. Я проверил, и мой провайдер не блокирует порт 22, я попытался отключить брандмауэр, переадресацию портов и т. Д., Но ничего не получилось. У меня нет монитора с подключением HDMI, поэтому я не могу проверить, могу ли я войти в компьютер на работе с помощью Raspberry Pi. Буду признателен за любые предложения. Заранее спасибо.

2

1 ответ на вопрос

2
Divin3

So I made a picture to illustrate our current state and help the explanation.

enter image description here

"A" is the computer at home, "B" is the computer at work, "C" is another computer at work.

"C" does have access to "B".

"A" does not have access to "B" and this is our problem that has to be solved.

The most common reason for this is that "B" and "C" are in the same network, "A" has to get trough the router to be able to access "B" or "C".

"B" and "C" has local IP addresses lets say for example 192.168.13.10 for "B" and 192.168.13.20 for "C". The router also has his own IP addresses one internal (ex. 192.168.13.1) and one external (ex. 10.10.10.11) that can be reached over the internet.

"B" and "C" can talk to each other with ease by calling each other over the local IP address, since they are in the same network if "C" wants to talk to "B" over port 22 all he has to do is open communication on 192.168.13.10:22.

It gets a bit more complicated when "A" wants to reach "B" or "C", since there is only one IP address that can be accessed over the internet, and that is the routers external IP address: 10.10.10.11.

What happens here is, there has to be a port forwarding on the router meaning that, lets say we want to forward all the information that the router gets on port 12345 to the port 22 of "C". So we must set up the routers port forwarding saying that inbound connection on port 12345 to be forwarded to 192.168.13.20:22 (address of computer "C")

From now on, if I want to access the port 22 of computer "C" from an external computer, I just have to connect to 10.10.10.11:12345


so in order for this to work and to be able to access computer "B" from computer "A", we must have a port forwarding in the router on a free port that refers to the internal address of computer "B"s port 22.

С тех пор мне удалось получить доступ к Raspberry Pi после чистой установки. Я предполагал, что это была та же самая проблема, которая мешала мне подключиться к обоим, но теперь мне стало ясно, какие дополнительные сложности возникают при попытке подключиться к ssh к ПК за пределами моей локальной сети. Спасибо за четкое объяснение. Сейчас уже довольно поздно, но завтра утром я все переживу. Michael 8 лет назад 0
Я рад, что смог разобраться. Если у вас есть какие-либо вопросы, чувствуйте себя уверенно. Хорошего дня :-) Divin3 8 лет назад 0

Похожие вопросы