13

I'm observing really annoying issues with connectivity to RasPi on WiFi network. I have device connected on both LAN cable and WiFi. If both cable and WiFi dongle are plugged - both interfaces are working fine and I'm able to connect to RasPi through IP addresses of both interfaces.

However, when I unplug the LAN cable - after restart - RasPi becomes unavailable by SSH. If I unplug - till restart - device is still fully available via WiFi interface through SSH! After restart - it cannot be accessed any more.

Here are my settings: /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
        ssid="linksys"
        scan_ssid=1
        mode=0
        proto=WPA2
        auth_alg=OPEN
        pairwise=CCMP
        group=TKIP
        key_mgmt=WPA-PSK
        psk="xxx-password-here"
        id_str="raspberrypi-wif"
        priority=1
}

Please, help to identify the reason of the issue.

5
  • From the local console check to see if you have a default route after you disconnect one of your networks. Perform netstat -r to see your route table. I have a similar problem. Oct 9, 2013 at 20:43
  • looks like it is as expected, before and after. I can see that eth0 just disappeared from list. Oct 11, 2013 at 19:01
  • @HeatfanJohn, have you managed to solve your issue? Oct 11, 2013 at 19:02
  • My eth0 interface behaves strangely, the interface remains "up" even after disconnecting the Cat-5 cable. I will create a new question with my problem if I don't figure out the issue Oct 12, 2013 at 13:25
  • for newbies like me, executing sudo raspi-config then (re)enabling SSH in Interfacing options I've got eth1 (USB Ethernet adapter) to accept SSH connections both from local lan and Internet Dec 24, 2018 at 17:14

3 Answers 3

8

Check to make sure your SSH config is set to listen on all interfaces. This will ensure that if the system boots and only WiFi is available, it will listen on the WiFi interface. I suspect this is ok based on your above description, but it is worth checking anyway.

The other thing I would do is watch the boot process via a monitor (if possible, or via dmesg and logs after the fact), to check if the wireless interface is actually available before SSH tries to start.

Depending on your wireless device, it may not be initialized or available at the time the SSH daemon is starting, which causes SSH to fail, and therefore no access to the Pi via SSH after a reboot with wireless only.

4
  • Thanks for response, what is interesting, ssh is available on all interfaces: ListenAddress 0.0.0.0 in /etc/ssh/sshd_config. And I can see WiFi interface is active from router: raspberrypi Wireless 192.168.1.105 00:02:72:B7:9A:C5 but I cannot ping the ip. I will try to watch the boot as you suggested. Oct 11, 2013 at 18:55
  • I have looked at dmesg and found that even if I start with WiFi only, it shows only lines regarding eth0 interface and nothing regarding wlan0. Really strange. screenshot Oct 11, 2013 at 19:14
  • 1
    Thank you, Hurgh, your response was really helpful. I have forgotten that I have previously hacked /boot/cmdline.txt to assign static IP address to RasPi (which differs from IP which my router allocated to WiFi interface of the device). It is fully my mistake. Using dmesg I was able to debug the issue and corrected this. Now working fine. Thanks a lot! Oct 11, 2013 at 19:43
  • Glad I could help, sorry I didnt get back to you between messages. Thanks also for posting your final solution, will help others (and me) next time the same question comes up.
    – Hurgh
    Oct 13, 2013 at 8:06
3

I had exactly the same issue on a Beaglebone Black. After wasting a day fiddling with /etc/network/interfaces settings, I noticed that eth0 is up/active after boot, even if the network cable is disconnected at boot time (just issue a route command and you will see eth0 listed). This seems to interfere with the connectivity of wlan interface. The cure is deactivating eth0 (ifdown eth0), and alas, the problem is gone for good. Plugging and unplugging the network cable had the same effect (it has the side effect of deactivating eth0). After that, I can ping/ssh wlan0 interface from any device in my home network. Guess that I shall write some script for detecting at boot time whether eth cable is plugged or not, and shutting down eth0 if it isn't.

-3

For what it's worth, I was having the same trouble (ssh fine via ethernet, no go via wifi), and I found that the wlan0 in the /etc/network/interfaces was set to manual, rather than dhcp. Changed it and started working ok after reboot

1
  • Did you look at the /etc/network/interfaces file the OP included? Sep 21, 2015 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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