Raspberry Pi Network
I’ve just got something super minimal, but actually useful working on my Pi. It’s a node server serving up a web page that toggles a button that switches an Energenie Plug on and off.
One of the problems I’ve been having is that Raspberry Pi keeps losing connection to the Wifi network. Here are the two things I’ve done to fix the problem.
Wifi Disconnects / Dies / Sleeps
If you are using one of the Edimax USB Wifi Dongles, you may find that after a while the Wifi just dies / disconnects. Turns out it’s sleeping due to some power saving settings that are defined out of the box
You can fix this by following the [instructions from Adafruit] (https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/test-and-configure#fixing-wifi-dropout-issues) which are outlined below.
Create and edit a new file /etc/modprobe.d/8192cu.conf
sudo nano /etc/modprobe.d/8192cu.conf
Paste the following:
# Disable power saving options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1
Reboot with
sudo reboot
, skip this if you intend to follow the next step as well.
Wifi Doesn’t Reconnect
All was well with the above tweak, but after a few days, either the internet or my router died and the Pi never came back online.
That is when I stumbled on this Stackoverflow post.
The most popular solution is the one I went with (i.e. not the selected answer) and it’s worked perfectly so far - although there are some reports that it messes with Ethernet, so be warned.
sudo mv /etc/ifplugd/action.d/ifupdown /etc/ifplugd/action.d/ifupdown.original
sudo cp /etc/wpa_supplicant/ifupdown.sh /etc/ifplugd/action.d/ifupdown
sudo reboot
This replaces an existing script with one provided by the wpa_supplicant package. Presumably, the wpa_supplicant script is more aggressive in terms of reconnecting to a wifi network should it go offline.
Found an issue?
All my posts are available to edit on GitHub, any fix is greatly appreciated!