View previous topic :: View next topic |
Author |
Message |
l_bratch Guru
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Wed Sep 26, 2007 12:17 am Post subject: Auto reconnect to ppp0 |
|
|
Hi all
I currently have a Gentoo router running kernel 2.6.22-gentoo-r5 and ppp-2.4.4-r9.
This connects to the internet using a PPPoE modem, using Gentoo's built in support for net.ppp0 scripts.
However I currently have a bit of a problem with my USB network adapter, that means the kernel loses sight of it every so often, then sees it again around 30 seconds later. So the device (eth3) actually disappears and reappears completely.
This causes the connection to drop obviously, but it is not coming back up.
I know the real solution to this is solve the USB problem, however this is a remote machine that I won't be physically at again for a couple of months!
Is there a way to automatically reconnect in this situation?
Thanks! |
|
Back to top |
|
|
mattsteven Apprentice
Joined: 27 Oct 2003 Posts: 240 Location: Your Planet
|
Posted: Wed Sep 26, 2007 7:31 pm Post subject: |
|
|
I had this problem once, and wrote a brief shell script to check the interface every 2 minutes or so.
Unfortunately I have long ago lost it since I figured out that booting with "noapic" and maybe a few other flags relating too pci and interrupt handling on that box made the kernel start behaving.
You might try the latter, or just stick /etc/init.d/net.ppp0 restart in an every 5 minute cron job. Though this is really a lame way to handle it, write up a shell script to detect its status and restart selectively instead if you want something a little brighter. If I find mine I will post it here. _________________ Matthew Steven
Linux-only desktop since 1998
Graying hair since 2006 |
|
Back to top |
|
|
l_bratch Guru
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Wed Sep 26, 2007 7:36 pm Post subject: |
|
|
Thanks for the reply, I'll assume there is no built in method for this if you didn't find it either.
I'm going to give writing a script a try, but I would appreciate it if you could post yours if you happen find it! |
|
Back to top |
|
|
l_bratch Guru
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Wed Sep 26, 2007 9:28 pm Post subject: |
|
|
Well I was writing a horrible complicated grep/sed/awk command, but then realised doing it this way would be a lot simpler. And I have come up with two ideas:
Code: | ping -c 1 82.112.137.1 && echo "ppp0 up!" || /etc/init.d/net.ppp0 restart |
or
Code: | ifconfig ppp0 && echo "ppp0 up!" || /etc/init.d/net.ppp0 restart |
The first one pings my ISP (as in ppp0's default gateway). If it responds, everything is good, if it doesn't it restarts ppp0.
The second one just queries ppp0. If it exists everything is good if not it restarts ppp0.
The first one might restart ppp0 without need if there is normal packet loss, or even if the line is saturated and the timeout is exceeded.
The second one might return success if the kernel things ppp0 exists but really there is no connection...
I'm going to stick with the second one for now, I just wondered if anyone had any further suggestions or improvements? |
|
Back to top |
|
|
mattsteven Apprentice
Joined: 27 Oct 2003 Posts: 240 Location: Your Planet
|
Posted: Wed Sep 26, 2007 9:54 pm Post subject: |
|
|
at least in my case I think ppp0 was still registered so it returned something, you might grep it for your ip address or something that should be in the output of ifconfig also _________________ Matthew Steven
Linux-only desktop since 1998
Graying hair since 2006 |
|
Back to top |
|
|
|