This happens a lot with one of my Raspberry Pis. I have a script which checks for an Internet connection and runs ifup wlan0
when a connection is not present. Some of the things you could try:
- Rebooting the Raspberry Pi
- Checking that you have a valid IP address using
ifconfig
- Ensuring that you have power-saving features disabled on the dongle by adding
wireless-power off
to your /etc/network/interfaces
file
- Run
ifup --force wlan0
Here's a script which runs every five minutes from cron:
#!/bin/bash
#Script to check the network connection
#Check network connection
if /sbin/ifconfig wlan0 | grep -q "inet addr:" ; then
#Connection is good; do nothing
echo "$(date "+%D [%H:%M:%S]") Connection is up"
else
echo "$(date "+%D [%H:%M:%S]") Network connection down. Attempting to reconnect..."
sudo /sbin/ifup --force wlan0
fi
If that is a wireless card power management issue, you can also have a look at WLAN disappears after some time.
Many wireless network cards don't support wireless-power off
option in /etc/network/interfaces
. To disable power management with a 8192CU module loaded, you can create a file sudo nano /etc/modprobe.d/8192cu.conf
with the following contents.
# Disable power management
options 8192cu rtw_power_mgnt=0
/sbin/ifconfig
just in case it's not the correct one ?ping google.com
on the Pi and try ssh'ing at the same time.