Hello all! :-)
Just wondering if anyone here could help me out with a weird problem I'm having regarding internet dropping out/disconencting after a random amount of time. Let me explain.
Right now - for a server - I'm currently using a dreamplug. It is acting as a simple webserver and is running ok. However I am currently in the process of replacing it with a different machine, a
banana pi a device similar to the rasberry PI though using a different cpu (Allwinner A20).
The distro that the banana pi (or b-pi for short) is using is just the default distro
bananian which is essentially just a debian 7 install.
First of all though I should also mention that I'm using two USB devices with the b-pi. They are a USB ethernet (ASIX AX88772 chipset) and a USB wifi (AR9271 chipset) devices.
What I've been trying to do on the b-pi is to get it to do the following: be an SSH server, a blog, a web server and wireless access point. The good news is that after a lot of reading online/going over webpages/help files and soforth I largely have it all working.
I can connect to the b-pi securely (SSH), the web server (lighttpd) works fine, the blog software is working ("flatpress" (also uses PHP5 btw)) and the wireless access point (via hostapd) is working too; I can connect to the b-pi via wifi and use the 'net with no problems.
Only snag though is there's one problem (which I was expecting!) and that's this odd problem whereby after X amount of time the internet connection will drop. Once the connection drops I can't ping the b-pi at all and the web blog dosen't show up either. Only way to restore it is to pull the power, wait a little while and plug the power back in again.
So far the "uptime" I've had before the device drops is as follows -- first attempt about 2 hours; the second attempt lasted a little over 24 hours before it dropped and I had to disconnect the power and re-plug in again.
It is my guess that somehow somewhere there must be in configuration scripts some lines or code that looks out for a dropped connection then reconnects if it has dropped. I understand that programs (eg wicd) can do this too but wicd will not work if you're trying to configure things manually so as to create a wifi bridge/AP point! It is all made equally more weird when I know that the older dreamplug dosen't even seem to drop its connection at all - !
Here is a script which I came up with btw to try to check the 'net connection and if it fails, count up to 5 when at that point a reboot occurs;
Code:
#!/bin/sh
#
if=eth0
if [ -e "count.var" ]
then
:
else
echo 0 > count.var
fi
count=`cat count.var`
if ping -c 1 192.168.0.1 | grep "Unreachable"; then
ifconfig eth1 down
ifconfig eth1 up
ifconfig wlan0 down
ifconfig wlan1 up
count=$((count+1))
echo $count > count.var
else
:
# date >> /root/date1.txt
exit
fi
if [ $count -eq 5 ] then
count=0
rm count.var
echo "**fail" >> /root/date1.txt
shutdown -r now
exit
fi
$ chmod +x /root/reconnect
And this in /etc/crontab as well;
Code:
*/1 * * * * root /root/reconnect
(and then restart the b-pi). So far I am just waiting for the next drop so I can see if this script works (it does at least appear to be running). The problem though is this really does feel like a major bodge I am doing here and that I'm not doing the right thing with regards to restarting a dropped internet connection.
So I'm wondering what is the software doing on the dreamplug that the b-pi's software isn't doing? Is there some "correct" way that a 'net connection that drops should be restarted by?
ljones