2
  1. I have a raspberry at home with SSH server, RSA keys configured and port 22 open on the router.
  2. I have another Raspberry Pi (client), with which I can connect to my house ONLY by LAN (with ssh from terminal and with putty from desktop).
  3. Instead, I can connect to it with Putty (on Windows) and with Termux (on Android), from LAN and from INTERNET (without port forwarding problems).
  4. I am unable to connect SSH from the Raspberry Pi client to the Raspberry Pi server over the INTERNET, both with domain and public IP.
  5. I have tried ssh -v -v -v pi@domain.com -p 22 and ssh -v -v -v pi@public-ip -p 22 with result:
pi@raspi2:~ $ ssh -v -v -v pi@public.ip
OpenSSH_7.9p1 Raspbian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolve_canonicalize: hostname public.ip is address
debug2: ssh_connect_direct
debug1: Connecting to public.ip [public.ip] port 22.
debug1: connect to address public.ip port 22: Connection timed out
ssh: connect to host public.ip port 22: Connection timed out
pi@raspi2:~ $ 

NOTE: /etc/ssh/ssh_config line 19 contains: Host *

What I can do?

  • What do you get with ping <public_ip> and with sudo nmap -Pn -p 22 <public_ip> from the RasPi client on internet? – Ingo Apr 12 at 18:32
  • Welcome, Tipoduro. I've removed the references to SSHFS because they seem superfluous to the problem. As Ingo says, you should try ping using public.ip. If that fails, then SSH is also sort of superfluous to the problem: You simply cannot reach the Pi by any means. – goldilocks Apr 12 at 18:42
  • You should explain how you have arranged to make your home LAN accessible from outside, because by default this is usually not the case, ie., you can connect from the LAN to the internet, but not from the internet to the LAN -- that's normal. – goldilocks Apr 12 at 18:44
  • Unless you ‘open LAN’ description throws something up, it may be worth talking to the ISP - they may block ports on their side. – Andyroo Apr 12 at 19:42
  • Thanks for the collaboration. The problem is the Raspberry Pi client, since I can access the server with Android and Windows (from outside LAN). The results of the commands are: ping <public.ip> 4 packets transmitted, 4 received, 0% packet loss, time 8ms rtt min/avg/max/mdev = 81.615/97.342/110.134/11.399 ms sudo nmap -Pn -p 22 <public.ip> Host is up. PORT STATE SERVICE 22/tcp filtered ssh Nmap done: 1 IP adress (1 host up) scanned in 2.51 seconds Do I understand that it is the Raspberry client itself that blocks outgoing port 22? How could I allow it? – Tipoduro Apr 13 at 7:09

Your Answer

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

Browse other questions tagged or ask your own question.