2

I have a problem that I've a Raspberry Pi I'd like o connect via SSH (throughout the home network). In the past this worked fine; however, since I re-used my Raspberry Pi after a while and wanted to connect from my Mac — it wouldn't allow me to connect to the Raspberry Pi. Furthermore, I also cannot ping the Raspberry Pi from my Mac. If I ping I get 100% package loss on the Mac; However, I can just fine connect to the RPi from another PC (Windows). I can also ping my Mac from the Raspberry Pi.

Ping from Mac to IP of Raspberry Pi:

ping: sendto: No route to host
Request timeout for icmp_seq 0

Running verbose SSH on the Mac yields

ssh: connect to host <IP> port 22: No route to host

Running arp on Mac (Raspberry Pi is connected via wlan - the wlan0 MAC address of the Raspberry Pi matches the output of arp)

<pi-hostname>.lan1 (<pi IP>) at <MAC Address> on en0 ifscope [ethernet]

I'm not sure what the problem is - I have reinstalled the OS on the Raspberry Pi - and get the above output. I've previously connected via ssh-keys (before reinstall) to the Raspberry Pi - and suspect that the problem might be somewhere here, but I know too little about networking to figure it out.

Raspberry Pi also shouldn't have iptables or ufw installed and blocking the Mac.

Edit 1:

  • The subnet should be the same for all devices:
  • netmask 0xffffff00 for Mac
  • 255.255.255.0 for Pi

Rout get Mac:

 route to: <hostname-RPI>.lan1
destination: <hostname-RPI>.lan1
 interface: en0
 flags: <UP,HOST,DONE,LLINFO,WASCLONED,IFSCOPE,IFREF>
 recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
 0 0 0 0 0 0 1500 943

On Windows (route get wasnt avialble)

Tracing route to <hostname-RPI>.lan1 [<IP-PI>]
over a maximum of 30 hops:
1 * 94 ms 4 ms <hostname-RPI>.lan1 [<IP-PI>]
Trace complete

Output from Find-NetRoute -RemoteIPAddress <$RPI-IP>

IPAddress : <Windows IPv4 Adress>
InterfaceIndex : 2
InterfaceAlias : WiFi
AddressFamily : IPv4
Type : Unicast
PrefixLength : 24
PrefixOrigin : Dhcp
SuffixOrigin : Dhcp
AddressState : Preferred
ValidLifetime : 6.23:53:09
PreferredLifetime : 6.23:53:09
SkipAsSource : False
PolicyStore : ActiveStore
Caption :
Description :
ElementName :
InstanceID : ;C<8;@B8;8:9<>55<55:8:8:8:55;
AdminDistance :
DestinationAddress :
IsStatic :
RouteMetric : 256
TypeOfRoute : 3
AddressFamily : IPv4
CompartmentId : 1
DestinationPrefix : 192.168.1.0/24
InterfaceAlias : WiFi
InterfaceIndex : 2
InterfaceMetric : 35
NextHop : 0.0.0.0
PreferredLifetime : 10675199.02:48:05.4775807
Protocol : Local
Publish : No
State : Alive
Store : ActiveStore
ValidLifetime : 10675199.02:48:05.4775807
PSComputerName :
ifIndex : 2
asked Aug 28 at 7:04
7
  • 2
    Does macOS have the route get command, and if so, what does that report for the Pi's IP address compared to e.g. the Windows PC's IP? If not – what does netstat -rn show? Commented Aug 28 at 7:16
  • Hi - i have checked this - and edited the results Commented Aug 28 at 17:11
  • The Windows equivalent would be Find-NetRoute -RemoteIPAddress x.x.x.x in PowerShell (and the Linux equivalent is ip route get x.x.x.x with/without fibmatch), but since all devices are in the same subnet, it's easy to guess what route Windows has (the local subnet route). It's the macOS behavior that seems unusual, as normally "No route to host" means it didn't get any ARP reply (and not anything route-related), but your output shows there being a successful ARP cache entry, so I was guessing there might actually be a weird route. Commented Aug 28 at 17:36
  • Post the OpenSSH configuration file for the Raspberry Pi. Commented Aug 28 at 19:42
  • Hi - I've added some more information. Furthermore, currently the RPi does not have a config file created - nor does it even have the ssh directory under ~/.ssh/ Commented Aug 29 at 3:04

1 Answer 1

-2

I also faced the same problem last week and I used following method which actually worked for me.

Ensure Mac and Raspberry Pi are on the same Wi-Fi network (not guest or isolated). After that disable Mac firewall temporarily:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

Then flush ARP cache on Mac:

sudo arp -d <pi IP> 

And restart Wi-Fi on Mac. Try SSH again:

ssh pi@<pi IP>
Giacomo1968
59.1k23 gold badges180 silver badges225 bronze badges
answered Aug 28 at 11:04
2
  • Disabling a firewall entirely is bad and should not be necessary. Instead, identify the ports the service you're trying to use requires, and allow those. Disabling a firewall, even on your very own LAN, is a bad idea. Commented Aug 28 at 13:19
  • Horrible advice. Having to disable the firewall every time you want to SSH into the device is lousy and insecure advice. It’s a response that I would expect ChatGPT to generate Commented Aug 28 at 19:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.