Page 1 of 1

SSH "Port 22: Connection Refused" Error

Posted: Thu Nov 07, 2019 4:25 am
by yogickitty
I am attempting to connect to my RPi 3B+ through SSH from a Mac terminal but am receiving a "Port 22: Connection Refused" error message when I type "ssh pi@my_ip".

I was previously able to connect successfully from a different location and wifi network. However, this problem started when I attempted to connect from somewhere else.

I reconfirmed that SSH is enabled in the Pi settings, that both my mac and the pi are connected to the same wifi network, and I also used ifconfig to get the new ip address and am using the new address instead of the old one in the same way I was doing before when it was working at my previous location. I read through this thread for the same error: ... p?t=144839, but it does not appear that the suggestions here apply to my particular circumstance.

Does anyone have insights in reconnecting to the Pi through SSH after switching wifi networks and an ip address change? Not actually certain this is the reason I am encountering this issue but I'm uncertain as to what else it could be.

Re: SSH "Port 22: Connection Refused" Error

Posted: Thu Nov 07, 2019 6:54 am
by HawaiianPi
In your new location do you also have a new router?

If so, and you are using a wireless connection, then AP Isolation may be enabled in the router. It's basically a security feature that prevents wireless clients from accessing the local network.

Re: SSH "Port 22: Connection Refused" Error

Posted: Sun Nov 10, 2019 5:22 pm
by juice2194
Thanks for the AP Isolation info! I've been having a similar issue. Do you have any guidance on where I might start to confirm whether my home WiFi has AP Isolation configured?

Re: SSH "Port 22: Connection Refused" Error

Posted: Sun Nov 10, 2019 10:49 pm
by HawaiianPi
On my ASUS router it's located in the Wireless settings under the Professional tab.
APisolation.gif (14.05 KiB) Viewed 4103 times

Hopefully it won't be hard to find in your router (assuming it has that setting).

Re: SSH "Port 22: Connection Refused" Error

Posted: Mon Nov 11, 2019 12:38 am
by dustnbone
Easiest way to find out if you have connectivity is to ping one device from the other. If it succeeds your SSH problem is on the server side. Make sure it's set to accept remote connections through the appropriate network interface(s).

Re: SSH "Port 22: Connection Refused" Error

Posted: Tue Nov 12, 2019 4:53 pm
by DougieLawson
Connection refused has three causes.
1. Wrong IP address
2. Right IP address, wrong port
3. Right IP address, right port, server not listening

They're easiest to fix in reverse order.

Use something like Fing (app on phone or desktop) or nmap to scan your network. Once you find a MAC address that matches the RPF/RPTL OUIs then scan that address again for open ports.