yogickitty
Posts: 4
Joined: Sun Oct 06, 2019 4:16 pm

SSH "Port 22: Connection Refused" Error

Thu Nov 07, 2019 4:25 am

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: https://www.raspberrypi.org/forums/view ... 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.

User avatar
HawaiianPi
Posts: 4750
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH "Port 22: Connection Refused" Error

Thu Nov 07, 2019 6:54 am

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.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

juice2194
Posts: 1
Joined: Sun Nov 10, 2019 5:16 pm

Re: SSH "Port 22: Connection Refused" Error

Sun Nov 10, 2019 5:22 pm

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?

User avatar
HawaiianPi
Posts: 4750
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: SSH "Port 22: Connection Refused" Error

Sun Nov 10, 2019 10:49 pm

On my ASUS router it's located in the Wireless settings under the Professional tab.
APisolation.gif
APisolation.gif (14.05 KiB) Viewed 84 times

Hopefully it won't be hard to find in your router (assuming it has that setting).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

dustnbone
Posts: 36
Joined: Tue Nov 05, 2019 2:49 am

Re: SSH "Port 22: Connection Refused" Error

Mon Nov 11, 2019 12:38 am

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).

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: SSH "Port 22: Connection Refused" Error

Tue Nov 12, 2019 4:53 pm

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.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Troubleshooting”