LinuxQuestions.org
Register a domain and help support LQ
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 08-11-2005, 11:29 AM   #1
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Monitoring ADSL (to keep online), adsl-start


I've recently discovered that D-Link isn't officially supported by Bell Sympatico (my IHV provider), so I've canned my router and plugged straight into my linux box, which is now a nice gateway. (My original problem was frequent disconnects, and my router couldn't reconnect unless I cut the power, which I can't do from 1500 km away very easily).

Now that I have adsl-start working, I want to know if there's a way to monitor my connection to mak sure it's online all the time.

I was thinking that calling adsl-status and grepping for "Link is up..." in a cron job would be a good way to go, but my expression evaluation knowledge is not very good for sh/perl; can anyone lend a hand there ?

Of course, if adsl-start monitors the connection itself (I have it set to NO for dial-on-demand) that'll work too.

Sub query: why does adsl-connect keep the tty locked, and not release it once it's connected ? If I background the job by calling it as `adsl-connect &` will it just die when I log out of the shell ?
 
Old 08-11-2005, 03:48 PM   #2
Half_Elf
Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 45
First of all, don't listen to ANYTHING sympastico tell you, I mean it, they are deep idiot that don't know anything about DSL. I used to be one of their customer, but left because I had enought of their BS. So the "we don't support your router" mostly mean "we don't want to show our tech what a router is". Unless they changed, they don't support linux as well (mean they will refuse to answer your question, even if you ask for the mail server hostname, if they find out that you use linux).

Whatever, first of all, some tips... DSL shouldn't disconnect often usually. If it does, there might be a problem about your phone line. I don't know about Ottawa, but in Montreal, a lot of buildings have crappy phone line. However to make sure, you can ask sympatico to send you a tech to do a "sound test" over your line (mean they will test there is no interference). Back in time it was free, but someone told me they now charge for this... I don't know, thought, you will have to try your luck.
Also, a tech another DSL company (they all share the same phone network) told me you had to reduce you MTU to 1444 on their network, otherwise you could experiment lot of dataloss.


Here is a script I done to keep me online all the time. It is pretty bad and buggy, it was one of the first script I made but I switched to linux. I don't rewrite this because I am too lazy
Basically, the script search for "ppp0" in /proc/net/dev (network interface), if it's there, it checks that the ip (in /etc/LstIp in this script) is the same (in case they just dropped you and that adsl-start reconnected you). It also note the date when it does (so you can complain to sympatico saying WHEN you did lost connection). Just add a line in cron about this script every 5 mins or so and you will be fine.

Note it use "pon" and "poff" instead of adsl-start/adsl-stop because I use this on some minimal debian box. Changing this to adsl-start/adsl-stop should work as well.

Code:
#! /bin/sh
# Small bash script to check if I'm connected to the internet
#

# Now, taking care of the DSL
echo "Looking for existing DSL Connection"

Dsl=`awk -F":" '/'ppp0'/{print $1}' /proc/net/dev`
if [ $? != 0 ]; then
        exit 1
fi

if [ ! $Dsl ]; then
        echo "No DSL connection!"
        poff &
        sleep 5
        echo "Starting DSL"
        pon dsl-provider &
        echo -e " `date`" >> /etc/ConnectTime
        sleep 15
        NowIp=`ifconfig ppp0 | grep "inet addr:" | awk -F : '{print$2}'| awk '{print$1}'`

        if [ $? != 0 ]; then
                exit 1
        fi

        echo "$NowIp" > /etc/LstIp
else
        LstIp=`grep . /etc/LstIp`

        if [ $? != 0 ]; then
                exit 1
        fi

        NowIp=`ifconfig ppp0 | grep "inet addr:" | awk -F : '{print$2}'| awk '{print$1}'`

        if [ $? != 0 ]; then
                exit 1
        fi

        if [ "$LstIp" != "$NowIp" ]; then #If the actual Ip is the same of the one in Ip
                echo "Last Ip was $LstIp and Actual Ip is $NowIp"

                poff &
                sleep 5
                echo "Starting DSL"
                pon dsl-provider &
                sleep 15
                echo "Saving New Data"
                echo -e " `date`" >> /etc/ConnectTime

                NowIp=`ifconfig ppp0 | grep "inet addr:" | awk -F : '{print$2}'| awk '{print$1}'`

                if [ $? != 0 ]; then
                        exit 1
                fi

                echo "$NowIp" > /etc/LstIp
                echo "Updating Done"
        else
               echo "Ip is the same,no update"
        fi
fi
[Subquery]
It's the way to do of any script... Backgrounding is somewhat attached to the tty, you can't close it, I can't really tell you why, I suppose it need the TTY information to keep it backgrounded.
Otherwise, if you start the connection from a "system script" (from a bootup script or from a cron job task) it should be good.

Last edited by Half_Elf; 08-11-2005 at 03:51 PM.
 
Old 08-12-2005, 08:44 AM   #3
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Original Poster
Rep: Reputation: 30
Hé merci Half_Elf !

I know I don't trust Sympatico's service team, they're not very competant in my experience (though I have had a few good ones). Telling them I also work for an ISP doesn't seem to help at all...

I have OK line quality. The reason I do think it might be the router is that when I do disconnect it can't reconnect unless I reboot the router, which indicates a software bug in the firmware to me.

And no, they don't officially support Linux, but it seems to work fine.

And as a side note, I did actually put adsl-connect into rc.local and it wouldn't release the tty, so it got stuck at boot prompt. I managed to get the WAN IP, drove to my school and used their wireless to log in and fix and reboot it. :P
 
Old 08-12-2005, 10:00 AM   #4
Half_Elf
Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 45
Pas de problème

Some routers or modem (althought Sympastico modem are known to be _very very good_, they don't lend you cheap hardware, just cheap service) do have firmware problem, sometime it's possible to upgrade the firmware (or to send back to the vendors) but most of time you have live with it. In any ways, I would recommend to browse your vendor (d-link?) web site carefully, as they probably hide the return webform very well (if they have any).
I once had a DSL modem that was crashing (litterally crashing, the modem was turning off itself!) because of bad quality phone line (sympastico so-called technician made me empty my cookies during 3 weeks 'til I blow up... then they send a real tech to check the line... it was about time).

Quote:
I did actually put adsl-connect into rc.local and it wouldn't release the tty, so it got stuck at boot prompt.
Don't use "adsl-connect", but "adsl-start", adsl-connect is mostly used to do weird stuff (like starting additionnal new connections... I once got up to 30 connections on the same machine (so 30 different ips) because I had a buggy script that was calling "adsl-connect &" endlessly I was using sympastico under slackware with rp-pppoe (adsl-start and this stuff) until 2 month ago and it wasn't locking terminal (I was calling it from rc.local as well... I like slackware KISS bootup scripts).


Oh and... make sure you NEVER mention to them you use linux, a router or an home network... back in time I had the bad idea to tell them I was a linux user so they had wrote it in my customer information and then they was refusing to help me, even if I was just calling to get mail server hostname or because the modem was crashing.

Feel free to send a pv mail... It's always fun to IM chat with linux users that are in the same city
 
Old 02-10-2006, 02:26 AM   #5
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 668
Blog Entries: 7

Rep: Reputation: 31
Nice Script helped me out
 
Old 02-10-2006, 06:28 PM   #6
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Original Poster
Rep: Reputation: 30
This is an old question of mine. Slackware 10.2 comes with pppoe-* tools that seem to monitor the connection for you. I now have only this in my rc.local and have never had a disconnect problem since.

Code:
########################
# LAN Configuration
ifconfig eth1 10.0.0.1 up
/usr/sbin/pppoe-start
/usr/sbin/pppoe-status
 
Old 02-11-2006, 10:55 AM   #7
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 668
Blog Entries: 7

Rep: Reputation: 31
pppoe-start and pppoe-status...refer to roaring penguin tools...I installed it on my debian box.. but they did not work properly...so I used to custom debian package for the pppd.
 
Old 07-12-2006, 06:43 PM   #8
dpajares
LQ Newbie
 
Registered: Apr 2004
Location: uruguay
Distribution: debian
Posts: 25
Blog Entries: 1

Rep: Reputation: 15
very good scrit, that work prefeclty.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
adsl-setup or adsl-start not found as user! bnchakraborty Linux - Newbie 2 01-18-2008 10:23 PM
How to set up t-online(de) adsl on any Slackware??? frik Slackware 2 08-21-2005 07:37 PM
Cannot get online with Mandrake 10.2 and PCI ADSL card - newbie! vedekandy_2005 Linux - Networking 3 06-29-2005 07:18 AM
Please Help Me Get Online-- Usb Adsl Modem Problems!!! akhilnair Linux - Newbie 4 10-25-2004 12:32 PM
ADSL Setup, Verizon Online sovietpower Linux - Networking 1 04-13-2004 04:33 PM


All times are GMT -5. The time now is 03:26 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration