5

I am trying to access Pi (ip: 192.168.11.20) using ssh via wifi (ap at 192.168.11.1) by another linux box (ip: 192.168.11.2). But it failed with the message:

ssh: connect to host 192.168.11.20 port 22: No route to host

It seems there is some problems on the route setup. Somehow the package can not be routed between Pi and linux box (as shown by the nmap output). Any comment is appreciated!

Here are the output of route -n on Pi (192.168.11.20)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Mestric Ref   Use  Iface
0.0.0.0         192.168.11.1    0.0.0.0         UG    0       0     0    wlan0
0.0.0.0         192.168.11.1    0.0.0.0         UG    303     0     0    wlan0
192.168.11.0    0.0.0.0         255.255.255.0   U     0       0     0    wlan0
192.168.11.0    0.0.0.0         255.255.255.0   U     303     0     0    wlan0

and the ifconfig

eth0      Link encap:Ethernet  HWaddr b8:27:eb:35:8b:e4
          inet6 addr: fe80::c39:5688:cd46:2d9f/64 Scope:Link  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:528 (528.0 B)  TX bytes:528 (528.0 B)

wlan0     Link encap:Ethernet  HWaddr 30:5a:3a:62:73:e5
          inet addr:192.168.11.20  Bcast:192.168.11.255 Mask:255.255.255.0
          inet6 addr: fe80::326a:3aff:fe62:73e5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:45 errors:0 dropped:3 overruns:0 frame:0
          TX packets:97 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6766 (6.6 KiB)  TX bytes:15543 (15.1 KiB)

and finally the nmap 192.168.11.* (192.168.11.2 is missing)

Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-16 23:33 CST
Nmap scan report for 192.168.11.1
Host is up (0.057s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
53/tcp open  domain
80/tcp open  http

Nmap scan report for 192.168.11.20
Host is up (0.00047s latency).
Not shown: 999 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh

Nmap done: 256 IP addresses (2 hosts up) scanned in 5.03 seconds

On the other hand route -n from linux box (192.168.11.2)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.11.0    0.0.0.0         255.255.255.0   U     2      0        0 wlan0

and ifconfig

eth0      Link encap:Ethernet  HWaddr 00:23:18:26:1c:85  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:d4700000-d4720000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:23143 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23143 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3462530 (3.4 MB)  TX bytes:3462530 (3.4 MB) 

wlan0     Link encap:Ethernet  HWaddr 00:27:10:01:eb:98  
          inet addr:192.168.11.2  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::227:10ff:fe01:eb98/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:143189 errors:0 dropped:0 overruns:0 frame:0
          TX packets:124849 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:88955604 (88.9 MB)  TX bytes:20473398 (20.4 MB)

and finally nmap 192.168.11.* (192.168.11.20 is missing)

Starting Nmap 5.21 ( http://nmap.org ) at 2015-12-16 23:40 CST 
Nmap scan report for 192.168.11.1
Host is up (0.032s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
53/tcp open  domain
80/tcp open  http

Nmap scan report for 192.168.11.2
Host is up (0.00028s latency).
Not shown: 995 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh 

Nmap done: 256 IP addresses (2 hosts up) scanned in 14.59 seconds

EDIT: Additional information on network setup

This is the content of /etc/network/interface on Pi

auto lo
iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "my_wifi_id"
wpa-psk "my_passwd"

Other information

When I connect Pi to router directly via ethernet port, ssh from linux box to Pi works flawlessly. Also, I can connect to Pi via wifi from external network if I configure ip forwarding on the router to redirect incoming port (e.g. 2200) to port 22 at Pi's address (in this case 192.168.11.20).

  • 2
    Can you ping between the boxes? If you can't, that's the problem to sort out. – joan Dec 16 '15 at 16:13
  • No, it failed with Destination Host Unreachable. But strangely, both ip can ping 8.8.8.8 and access internet normally. – kysc Dec 16 '15 at 22:28
  • What's between the two boxes? Something between them doesn't know how to get from one to the other. – joan Dec 16 '15 at 22:31
  • The connection is like this: linux box <-> wifi ap <-> Pi. Wifi ap is a simple Bufflo 150N router. I always access different machines within same subnet via ssh (even from android to laptop). I am quit certain the problem is in Pi's routing setup – kysc Dec 16 '15 at 23:34
  • I don't know why you have double entries on your Pi, but it looks suspicious. I'd also add auto eth0 to your /etc/network/interfaces even though I doubt it will solve your issue. On my router I can isolate wifi from the rest of the network ... maybe that's the case with you too? – Diederik de Haas Dec 17 '15 at 1:14
1

If you are connected through wifi, it's possible that the router's wifi is configured for "CLIENT ISOLATION". This option allows all the clients of the wifi to access internet but doesn't allow interaction with other clients.

I think that this is why you can ping 8.8.8.8 but no other wifi client in the local network.

The solution is to disable the "client isolation" option in your wifi (wifi settings -> advanced settings) and then you will be able to connect to other clients.

PD: Of course, I supose that you have the SSH server enabled with raspi-config! :)

-2

I had the following message:

ssh: connect to host 192.168.1.99 port 22: No route to host

And it was because the ether-net cable was unplugged.

Hope that helps.

  • But if you look at the ifconfig printouts, you'll see that there seems to be a wlan connection at both points, and that they seem to be on the same subnet. – Bex Feb 3 '16 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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