LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-21-2014, 10:35 AM   #1
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Rep: Reputation: 17
Internet connection randomly being dropped - correct way to reconnect it?


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
 
Old 09-21-2014, 02:12 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,288

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
What type of internet feed have you? ASDL over phone cable? wifi from afar?
 
Old 09-21-2014, 04:00 PM   #3
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
The internet feed is indeed ADSL! That comes through a normal land-line phone line btw. After that it goes through a homeplug powerline adapter then into a router both the dreamplug and the b-pi are plugged into the same thing (the router). They also both have fixed (but different!) IP addresses.

The intresting thing though is both the dreamplug and the b-pi are connected into the same router.

In the time since I posted my first post in this thread and typing this now I see that the counter in that script so far has gotten to 2; if it gets to 5, the b-pi gets restarted by the script. So it has had to execute the ifconfig commands twice, but hasn't yet gotten to the point of having to restart. A quick check (Right now) for the b-pi's IP address shows it is there.

ljones

Last edited by ljones0; 09-21-2014 at 04:09 PM.
 
Old 09-22-2014, 03:06 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,288

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
After a few years of unreliable internet I gave up on ASDL altogether. The reason was that the phone companies were 'upgrading their lines.' That meant slowly screwing up the minimum speed. Once they pushed it past 2MB, my line wasn't able to handle it - just too far from the exchange. The phone system had recently been de-monopolised, but they wouldn't fix my line because I was not getting service from the (rip-off) 'ex-monopoly' phone company.

I went to an mmds type feed to a local mountain, and have not looked back. The best internet feed around here (short of optical) is on the cable tv, but optical is available in many places.
 
Old 09-22-2014, 11:28 AM   #5
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
Unfortunatly not much option where I live btw with regards to an ADSL connection!

However I've had no luck x.x It still ended up dropping, and didn't seem to reconnect either. So prehaps my script dosen't work (not sure). Only thing I can think of is some sort of power management thing going on (wifi power management is *disabled* btw) maybe for the b-pi A20 CPU itself or a missing or not-quite-right config file.

:-(

ljones
 
Old 09-23-2014, 03:11 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,288

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
try resetting the modem at no-traffic and peak traffic times. It is probable that your modem will take longer to connect at peak traffic. I realise that isn't what you want with a website online, but if it matters, remote host it. You're not going to stake your reputation on a dodgy connection, are you?
 
Old 09-23-2014, 06:43 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,699

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Since the dreamplug does not drop out I would say it is just a b-pi problem. I assume the built in ethernet adapter eth0 does not drop out?

Have you looked at the output of the dmesg command to see if there are any errors on the b-pi when it drops out?
 
Old 09-23-2014, 12:30 PM   #8
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
I'm really hoping it isn't a b-pi problem. Only problem there I can think of would be some sort of weird CPU based power managment setup. Though I'm not sure.

Not seeing anything in dmesg btw, don't see any long list of errors. Currently I've not tried the built in ethernet though I've only not tried it as I've read the b-pi (Allwinner A20 CPU)'s ethernet chipset or driver is pretty lousy and dosen't yet run at full speed. Also I don't think it would be supported by hostapd.

So far after restarting (prehaps there was a bad connection) the server seems to be up. Am still monitoring it :-)

SP

Last edited by ljones0; 09-23-2014 at 12:33 PM.
 
Old 10-04-2014, 08:53 AM   #9
ljones0
Member
 
Registered: Dec 2007
Posts: 100

Original Poster
Rep: Reputation: 17
Well in the end I tried changing a couple of extra files. There were a couple of extra lines in /etc/sysctl.conf (vm.swappiness and vm.vfs_cache) which I removed. I also went right back to the debian documentation and redid /etc/network/interfaces .

That seems to have worked and the server kept going for a little over a week. Only reason it stopped is because I unplugged it to try to reconstruct what I did, write down everything. Now I've powered it back up again with a different SD card but tried to reconstruct what I did originally on a different SD card to see if I can re-do it all.

If this keeps going then it might be solved.

ljones
 
Old 10-04-2014, 09:16 AM   #10
greatbear
Member
 
Registered: Feb 2012
Distribution: ubuntu
Posts: 44

Rep: Reputation: Disabled
Whether or not it works, please tell us what did you change in your /etc/network/interfaces?
 
Old 10-04-2014, 10:38 PM   #11
GaWdLy
Member
 
Registered: Feb 2013
Location: San Jose, CA
Distribution: RHEL/CentOS/Fedora
Posts: 457

Rep: Reputation: Disabled
The swappiness and cache settings had no effect on your network problem. You should put them back to stock.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I manually disconnect/reconnect DHCP DSL internet connection? chaz_bro1972 Linux - Networking 34 06-06-2008 01:17 AM
Dropped Internet Connection grabro Linux - Wireless Networking 1 02-07-2008 10:36 AM
Internet connection drops how to reconnect a file transfer jspsandhu Linux - Networking 2 06-21-2005 04:43 PM
Can't reconnect internet when connection has lost Mikessu *BSD 1 06-18-2004 06:37 PM
silo overflow - internet connection dropped KaruppuSwamy.T *BSD 1 05-10-2004 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration