10

I am having trouble connecting to my Raspberry Pi over SSH when it is connected through WiFi. When the RasPi is connected through Ethernet everything works fine. However, when it is connected through the WiFi dongle, I can ping the router (on 10.0.0.2) and access the internet from the RasPi, but I cannot SSH to it (the ssh-command does not respond and eventually reports "Operation timed out"). I also cannot ping the RasPi on the static IP address assigned to it.

The WiFi dongle that I'm using is TP-Link TL-WN823N. I set it up on a static IP 10.0.0.28 using WICD. It is interesting that when I tried connecting via SSH with this WiFi dongle for the first time earlier this week, it did work. Now, that I'm trying it again, however, it is not working anymore. I didn't make any configuration changes as far as I can tell.

I have run some commands in order to provide you with some diagnostic information. All of these commands were run after I booted up the RasPi with the WiFi dongle connected, but with no Ethernet cable connected. I'm trying to connect to the device through 10.0.0.28 (as you might notice from /etc/network/interfaces, I have configured static IP 10.0.0.27 for ethernet; the static IP's for both interfaces used to be the same when I first had this problem, so I changed them to have different ones, just in case it might have caused some clash. Needless to say, that didn't work).

$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:c2:f1:37  
          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
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)

wlan0     Link encap:Ethernet  HWaddr c0:4a:00:1b:32:ca  
          inet addr:10.0.0.28  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:71 errors:0 dropped:95 overruns:0 frame:0
          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:8866 (8.6 KiB)  TX bytes:8377 (8.1 KiB)

$iwconfig
wlan0     IEEE 802.11bg  ESSID:"Mercutech"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:26:F2:26:B4:62   
          Bit Rate:54 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=85/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.

$ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet static
address 10.0.0.27
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.2

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

$ cat /etc/resolv.conf
nameserver 10.0.0.2

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.2        0.0.0.0         UG    0      0        0 wlan0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 wlan0

$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
  • You state that you can't SSH via "wifi only" - implying it works via some other method, have you started SSHD and can you SSH via eth0? – Nanzikambe Feb 22 '14 at 14:02
  • I can SSH via eth0, but not via wlan0. I believe SSHD must be running then. – bgh Feb 22 '14 at 15:08
  • Can you ping the Pi when it is on wifi? Please edit your question to show us the error message you get when you try to SSH into it. – guntbert Feb 22 '14 at 18:27
  • Hello guntbert. I have just tested and I see that I also cannot ping the Pi when it is on WiFi. I can ping it only through eth0. The ssh command hangs for a while and eventually reports "Operation timed out". I have updated the question with this info. – bgh Feb 22 '14 at 19:53
  • 2
    @bgh replace "wpa-roam" with "wpa-conf" in /etc/network/interfaces file for wlan0. – gurcanozturk Feb 23 '14 at 10:52
3

I have (too) struggled with this issue. When I connect the PI via a cable from my 'roadrunner' router everything is cool.

My ssh address is 10.0.1.7 and ssh pi@10.0.1.7 gets me to the PI from my Apple Mac. BTW I'm using an Edimax EW-7811Un wireless dongle in the PI. I'm running Wheezy on the PI.

It turns out that the simplest thing worked in order to ssh via WiFi with the ethernet cable unplugged.

I went to the Raspberry GUI (on my TV) and fired up the "WiFi Config" program and followed the directions entering my home wifi name and password. The thing I forgot was to CONNECT after I entered all the needed information. Once I pressed the CONNECT button my wifi was up and running and I could then unplug my ethernet cable. It is such treat to be "headless". My ssh address is 10.0.1.8 for wifi (was 10.0.1.7 for the ethernet cable)

  • Weird. I just unplugged the LAN/Ethernet cable and could then connect to SSH via WiFi. Plugged it back in, couldn't connect to SSH via WiFi. Strange behavior, works better on my Pi 3 B+. – geerlingguy Apr 4 '18 at 21:45
1

Try removing the static IP address for eth0, so change your interfaces file to this:

...
iface eth0 inet dhcp
# Comment all these out
#address 10.0.0.27
#netmask 255.255.255.0
#network 10.0.0.0
#broadcast 10.0.0.255
#gateway 10.0.0.2

I had a similar issue and this worked.

Another thing to try, see if these commands work (if not it might give you a clue):

sudo ifdown wlan0
sudo ifup wlan0
0

This crazyness happens to me as well. The only workaround i found was pinging the Pi via my Android Phone by using a terminal Emulator.

So, restart your Pi and connect it via Wifi. Let your PC ping against the Pi. Ping your Pi with a thrid device.

Your PC will start receiving answers from the Pi and you can finally SSH it.

0

Removing the hostname from known_hosts on the client was my fix for this. I'm assuming when attempting to ssh from the other NIC the key doesnt match partly due to the changed MAC address.

ssh-keygen -R hostname

0

I too have difficulty SSH to my RasPi A+ via my wireless. (you will recall the A+ has only one USB port and no wired ethernet). - I am connecting from within my home network. - The only router setting I've changed is to create a static IP for the RasPi. - I use PuTTY from a windows machine on the same network. - I have and EDIMax7811Un wifi adapter for the RasPi. - I've used Wheezy and now Jesse with same results. - I have no special wifi configure settings (other than enabling SSH) - Pinging the RasPi from my desktop shows the RasPi as unreachable.

My current "solution" is patience. It takes me 2 to 8 PuTTY timeouts before I make the connection. I tried typing various things from "SSH pi@192.168.x.xx" with no discernible difference. I get the same results when relogging into the RasPi with a tmux process still running. However, unless the RasPi is locked up I eventually connect.

JonRob

protected by goldilocks Nov 16 '15 at 16:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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