1

I am unable to connect to the SSH server on my desktop from my Android (Oreo 8.1) device over Wifi.

Here is the setup: Android and Ubuntu desktop are both connected to my Wifi, which is connected on the WAN side to my cable modem. If i turn on port-forwarding on the wireless router and send port 22 connections to the desktop, I can ssh into it using the modem's external IP address. I can't ssh into the desktop using the local IP address, whether or not port-forwarding is turned on.

I don't think this is a configuration problem on the wireless router, or on the desktop, as I can ssh into the desktop from a Windows machine using Putty. The Windows machine is on the same Wifi network, and i can ssh to my desktop using the local IP address just fine.

It also doesn't appear to be ssh-specific... I can't ping my desktop from Android, or even telnet to any open port. Or any closed port, i just tried; there's no error message, the command prompt never returns until i ctrl-c to cancel or the connection attempt times out.

I do have AFWall+ installed on the Android device, but using its "disable firewall" makes no difference. Even with it on, though, the shell, adb, root, and JuiceSSH all have full network permissions.

Is there something i'm missing in Android that would prevent only connections to local IP addresses?

Ping test results:

I can ping my desktop server from every other device on the same Wifi, just not from my Android.

The Android can ping every other device, including the LAN and WAN side of the Wifi router.

The desktop can ping the Android.

When using the Android's hotspot, the Android and desktop CAN ping each other (though, of course, the IP addresses are different).

Update

I never did get this resolved, but was making another attempt yesterday and discovered the following:

Any initial attempt to ssh to my server from the Android device just hangs. "netstat -t" on the server shows the connection is there, stuck at SYN_RECV.

If i run 'nc -l -p 22' on my Android device, and then establish an OUTBOUND connection from the server to the device, it temporarily fixes the problem. Even after closing this connection, i can ssh from the device into the server. It doesn't last, though, and the connection problem returns sometimes after a few minutes, sometimes a few hours.

Does this provide any clues as to whether the problem is on the phone or the server? Or how to permanently fix it?

  • If you aren't able to ping PC from Android, that's a networking problem. You can use ping or netcat (nc -nz <PC_IP> 22) to troubleshoot. Can you ping router from Android? Also, if you connect PC to phone's hotspot, are you able to ping? – Irfan Latif Dec 19 '18 at 10:51

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.