2

I have recently run into a very frustrating problem on my raspberry pi 2. Everything has been fine since initial setup (~5 weeks). I have a hidden WiFi SSID, but once I figured out how to set that up with the Pi, everything worked great.

Suddenly, this morning, I was getting 50-70% packet loss with ping (LAN or WAN) and connecting via SSH over LAN (wifi) was extremely slow and laggy.

pinging any local machine that was connected to my network via wifi or ethernet was giving large packet loss. Connecting via SSH with PuTTY was slow to connect (~10s) and after I connected, typing would be extremely slow and laggy, and would often freeze up entirely. I hooked the Pi back up via HDMI to troubleshoot, and typing was fine in the terminal (so it wasn't just my Pi being slow).

Long story short, I ended up setting up a static IP on the Pi and on my router, which has apparently resolved both the packet loss issue and the slow SSH issues (which are related, obviously). My question is:

  • why might this problem occur?
  • what diagnostics can I try next time this happens to figure out the cause?
  • why does setting a static IP fix the problem?

Here is my setup and configuration:

  • Model: Raspberry Pi 2 Model B+
  • Linux version: Raspbian Wheezy, Linux rpi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux
  • WiFi adapter: Canakit WiFi dongle, RT5370 chipset

/etc/networking/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet static

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off

iface default inet static
address 192.168.1.8
netmask 255.255.255.0
gateway 192.168.1.1

/etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="mywifissid"
        scan_ssid=1
        psk="mypassword"
        mode=0
        proto=WPA2
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        auth_alg=OPEN
        id_str="rpi"
        priority=1
}

network={
        ssid="guestnetwork"
        psk="guestpassword"
        key_mgmt=WPA-PSK
        disabled=1
}
  • 1
    When this kind of thing happens to me I usually just kill and restart the dhcp client, although it usually only happens on machines that can actually sleep (i.e., can disappear from the network). Dunno how to do that with the normal networking config though, maybe try service dhcpd restart. Worth consulting: raspberrypi.stackexchange.com/q/37920/5538 – goldilocks Dec 6 '15 at 19:58
  • what does output of ip addr say? I had a problem wherein my wlan0 had 2 ip addresses assigned to it and it caused some issues like this. – tejas Aug 15 '16 at 15:24
  • what is the quality on the WiFi? Can be checked with "iwlist wlan0 scan". – MatsK Aug 26 '17 at 6:55
0

May not be your problem, but I've seen odd things when two Linux IP interfaces (such as eth0 and wlan0) are on the same subnet (192.168.1.*). Sends can go out one interface and resonses come in on the other. The IP packets were given to TCP OK, but the asymmetry caused TCP/IP stack internal problems causing delays, timeouts and dropped connections.

My solution for wired and wireless LANs connected to a system is to use different subnets, e.g. 192.168.1.* and 192.168.2.*. The subnet IP address is typically configured using a web interface to each wired/wireless router. This configures the DHCP server in the router.

  • 1
    This is interesting. Could you edit your answer to include how one might resolve this issue? – ScheissSchiesser Dec 14 '15 at 14:32
  • This will not happen, the routing table have different metric for the different interfaces. Check with "route -n" and look what the metric column is saying for the different interfaces. – MatsK Aug 26 '17 at 6:49

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.