I'm trying to connect Raspberry pi3 via ssh over WIFi. its not working. Raspberry Pi is able to connect to router's wifi but ssh shows error

og@westside:~$ ssh -v pi@192.168.0.145
OpenSSH_7.3p1 Ubuntu-1, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.0.145 [192.168.0.145] port 22.
debug1: connect to address 192.168.0.145 port 22: No route to host
ssh: connect to host 192.168.0.145 port 22: No route to host

I'm able to ssh into Pi when its connected direct to router's Ethernet port. but when I try over WiFi(removing Ethernet Cable and connecting Pi to router). Its shows above error message.

wlan0 IP=192.168.0.145-shows error when ssh to it. Raspberry Pi's wifi address.

eth0 IP=192.168.0.103 -ssh successfully - Raspberry Pi's Ethernet address.

  • I've saved my Router's details in wpa_supplicant.conf file.
  • I've tried with static and dhcp configuration on raspberry pi's wlan0, through editing /etc/dhcpcd.conf.
  • My router is TP-Link TL-WR841N / TL-WR841ND
  • Laptop: Ubuntu

Is it possible that my router block SSH between two wireless connected devices ? but then again Its not blocking when One wireless connected device(Ubuntu) try to ssh to Pi(connected to router via Ethernet)

Please help me, I've wasted two days searching for this, I'm going nuts.

  • can you share your dhcpcd file? I assume your Pi is not taking the IP from the router. – Shan-Desai Feb 22 '17 at 12:18
  • 1
    If you have set up the same network on wlan0 and eth0 then no wonder it does not work. – techraf Feb 22 '17 at 12:18
  • also in raspi-config make sure your ssh is enabled. – Shan-Desai Feb 22 '17 at 12:23
  • Most common routers have an option to prevent devices connected over wifi to communicate with each other. This is mostly deactivated by default. Maybe try running a web server nginx or python simple web server module to see if you can establish a connection. – Tom-Oliver Heidel Feb 24 '17 at 2:01
up vote 1 down vote accepted

There are three possible places this could go wrong:

  1. Your Ubuntu box is blocking outbound TCP/22 to specific IPs or interfaces. There's basically a zero % chance of this because you can get your LT to talk to the Pi sometimes (i.e. when the pi is wired).
  2. Your Pi has some form of SSH interface listening interface or firewalling configured. I'm thinking this is unlikely, as you'd likely remember you did that through something like ufw.
  3. Your router/AP is blocking packets bound from one wireless station to another. I'm thinking this one's likely, as it's just a check box in your router's UI. From the TL-WR841N manual

Enabled AP Isolation - This function can isolate wireless stations on your network from each other. Wireless devices will be able to communicate with the Router but not with each other. To use this function, check this box. AP Isolation is disabled by default.

On a typical home network, I'd turn this on in a heartbeat to reduce the possibility of malware spread through the LAN by zombified Windoze boxen. If you didn't set up the router/AP, this is a good thing to check (since it's trivial to look at as long as you have login creds on the router).

Another thing you can check is to hit something else on the Pi (e.g. a simple "ping address_of_pi") to see if any packets are getting through at all. Given that you're getting "no route to host," I'm thinking that all IP to the pi is chopped off (if it were a port or interface block, you'd usually get something like "connection refused"). Another dead giveaway would be to use nmap to ping your whole local subnet (but that's an advanced topic...).

If it's not the AP, I'd double-check netstat and iptables on the Pi:

  • "netstat -lpn | grep :22" should have an IP like 0.0.0.0 or just :::22 (meaning it's listening on all interfaces).
  • iptables-save is a quick way to dump the firewall rules, but they're harder to read--just look for any references to port 22 or "DROP" in the output.

(Both of those should be run as root, btw).

If none of these, we start looking at weirder stuff (e.g. misconfigured bridge devices, oddball driver issues, ebtables), but those are pretty unlikely. Given your stated pathology, I'd say the router feature is your likely culprit.

And, of course, make sure you double-check the Pi's IP in both wired and wireless states and that the Pi itself can hit stuff (like "ping 8.8.8.8" is a good test of internet connectivity).

Good luck!

  • Thank You Boss. You are absolutely right, when used other router(Binatone), I was(After posting this problem) able to SSH to Pi over WiFi network.The problem is with my router. How To disable AP Isolation? – OgWestside Feb 22 '17 at 16:34
  • For your router, it looks like you choose "wireless" from the main menu, then "wireless advanced," then check off "enable AP isolation" and save. I just got that from the manual--i don't have one of these to test. – BJ Black Feb 23 '17 at 17:14

Go for the simplest most likely solution. Verify the following:

  • reset all your config files you have manually altered
  • laptop connected to wifi network check via command: ifconfig wlan0
  • Enable ssh on raspi via sudo raspi-config > advanced settings
  • raspi connected to same wifi network as laptop? check via command: ifconfig wlan0 and note the IP address
  • connect from laptop via terminal using ssh @IPaddressraspi example ssh pi@192.168.1.12
  • try ping your pi

This should work. if not disable firewall suspects on your router

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.