I connect to the same network via two interfaces- wifi USB dongle(wlan0) and a standard rj45 cable(eth0). Everything works fine prior to disconnecting the cable; after this, the wifi goes down too and access to machine is blocked since ssh is the only way. How to explain this? Below is my /etc/network/interfaces file. I can provide more information if needed.

auto lo

iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.1.113
        gateway 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255

auto wlan0
allow-hotplug wlan0
#iface wlan0 inet dhcp
iface wlan0 inet static
        address 192.168.1.112
#       gateway 192.168.1.1
        netmask 255.255.255.0
        wpa-ssid kklinksys
        wpa-psk <you don't need this, dear SO user ;)>

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
~

@UPDATE
ifconfig before unplug:

pi@nemo ~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:<censored>
          inet addr:192.168.1.113  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3327 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7887 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:330783 (323.0 KiB)  TX bytes:2870141 (2.7 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:77 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7462 (7.2 KiB)  TX bytes:7462 (7.2 KiB)

wlan0     Link encap:Ethernet  HWaddr 64:70:02:<censored>
          inet addr:192.168.1.112  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11912 errors:0 dropped:1325 overruns:0 frame:0
          TX packets:545 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1608214 (1.5 MiB)  TX bytes:139968 (136.6 KiB)
  • This is because you Pi would not be using wlan0. If you used the standard /etc/network/interfaces rather than the "customised" one it would work. Do you need both at the same time? – Milliways Jan 12 '15 at 23:06
  • @Milliways Yes, I need both independent interfaces with static IPs. I'd rather solve and understand this problem rather than avoid. – 0x6B6F77616C74 Jan 12 '15 at 23:21
  • Check ps -C ifplugd and if it's there, you might want to look into that. It is pernicious. – goldilocks Jan 13 '15 at 10:56
up vote 3 down vote accepted

Maybe the problem is the ARP table.

When you are connected using ssh to you rPi via eth0, you computer IP is mapped to a MAC address on the Pi's ARP table. To see this check the output of this command:

ip neigh show

This will show you the ARP table (IP - MAC address mapping). This is dynamic, though, but I cannot think on anything else at the moment.

I assume that you do not have keyboard nor serial connection to the rPi, this you have 3 options.

  1. Wait until the ARP table is updated.
  2. Change you IP address or use a different computer in your network to connect to the rPi.
  3. Reboot you rPi.

The later should do just fine. Another thing would be to schedule a command to flush the ARP table after you plug-off the cable from eth0, something like:

at ip nigh flush -v 18:30

or

nohup sleep 30 ip neigh flush &

those will flush your ARP table, thus you'r rPi will have resolve again using ARP protocol IP - MAC mapping after you are initiating the ssh connection.

  • Tried the last command and the problem doesn't exist even after reboot! Thank you, I would never guess that it was due to mess in ARP. – 0x6B6F77616C74 Jan 13 '15 at 15:35

I do not know the exact solution, using multiple interfaces is complex.

Why do you have iface default inet dhcp ? At best this will be ignored, at worst will break the configuration.

Check the output of ifconfig with both connected and after disconnecting the Ethernet.

Using static is inadvisable if you have a dhcp server. It is far better to use IP reservation by MAC on the router, if possible.

  • This is a Raspbian issue. There are no less than 10 questions on StackExchange related to after eth0 disconnection then failure to work only on wlan0. The simple fix is to 'ifdown wlan0 && ifup wlan0'. – fcm Jan 8 '16 at 15:10

I had the exact same problem. Strangely enough, the problem turned out to be a mis-configuration between my router and the pi!

My router (running Tomato) had a configuration on the "Wireless" page entitled "APSD mode management" which by default was on. Disabling it made the problem go away. Your router may have some similar way to disable this.

I'm told that when I turn this flag on, the router is announcing that it supports this specific power-saving feature. By turning it off, the rpi stops trying to save power in a specific way. I'm not sure whether the actual bug is in the router implementation or in the rpi implementation.

Your Answer

 
discard

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.