From owner-freebsd-questions Thu Jun 27 21:23:13 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3859937B400 for ; Thu, 27 Jun 2002 21:23:08 -0700 (PDT) Received: from homer.futureuse.net (c17994.randw1.nsw.optusnet.com.au [210.49.31.95]) by mx1.FreeBSD.org (Postfix) with SMTP id E6FA243DD9 for ; Thu, 27 Jun 2002 21:23:06 -0700 (PDT) (envelope-from fbsdlist@futureuse.net) Received: (qmail 86614 invoked from network); 28 Jun 2002 04:22:39 -0000 Received: from unknown (HELO futureuse.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2002 04:22:39 -0000 Received: from 203.11.225.5 (SquirrelMail authenticated user fbsdlist) by www.futureuse.net with HTTP; Fri, 28 Jun 2002 14:22:39 +1000 (EST) Message-ID: <42832.203.11.225.5.1025238159.squirrel@www.futureuse.net> Date: Fri, 28 Jun 2002 14:22:39 +1000 (EST) Subject: 2nd: Re: PPPoE flakiness From: "Aaron Hill" To: X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.4) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Are we not allowed to send shell scripts to FreeBSD questions? My response was bounced for this reason ... : 216.136.204.18 failed after I sent the message. Remote host said: 552 Error: content rejected Anyway, if anyone else is interested in the script you can get it from here ... http://www.futureuse.net/howto/pingmonitor/pingmonitor.sh Aaron -------- Original Message -------- Hello, Being a fellow Australian ADSL user (Bigpond) I know exactly what you're talking about and share your pain. I've been using ADSL since the trial period and have encountered the dodgy service issue only too many times. Take a look at the attached script. This is the solution I came up with for the problem. I hope the script reads ok, I did a rewrite of it recently to make it more appropriate to other peoples setup. I run it from cron with this entry (in /etc/crontab) ... # PING Monitor - check the ADSL connection every two minutes 0-59/2 * * * * root /usr/local/fwscripts/pingmonitor (That should be two lines. One line for the comment, one line for the actual cron job) What it does is get the default gateway from the tun0 interface and attempts to ping it. If the ping fails it will ping a secondary IP address which you hard code in the script. If both these tests fail a certain number of times (2 by default) it restarts the ppp daemon. It will keep bouncing ppp until the ping test works again. It keeps a count of how many times the ping test failed so when the ping test works it can send you an email to let you know what happened and how many times the test failed. By default this email goes to root. Based on how often you're running the script from cron you'll be able to tell the length of the outage from this email. The feature I like about the script is that it'll work with default gateways that don't allow ping. What it does if the primary gateway doesn't respond to ping is send a ping with a TTL of 1 to test if the gateway will send back a TTL EXCEEDED type ICMP message. My friend Paul Hoadley (hi Paul!) and I have been using the script for *months* and it works very well. I don't think it's let us down yet. We both run web sites and email services over the ADSL service so we need it up as near to always as we can get. Please give the script a go. I'd recommend you install it like such ... 1. Do a traceroute to anywhere over your ADSL connection to find the second hop IP address. 2. Add this second hop IP address to the script in the variable secondaryaddr. Alternatively you can use any external, reliable IP address like the Telstra DNS server on 139.130.4.4. 3. Change the variable max_second_hops to reflect how many hops that secondary IP address is away from you. Add a few hops onto this number to be safe. 4. Change the filename and path in the variable failedcountfile to something more relevant to your system. 5. Change the variable emailaccount to an email address you'd like the error reports to go to. 6. Make sure you can manually ping the secondary IP address. You might have to modify your firewall rules depending on your setup. 7. Make sure you can manually ping your default gateway and/or your firewall allows it to send TTLL EXCEEDED messages to the ADSL interface. This is icmptype 11 for ipfw. 8. Add the script to the crontab. kill -HUP cron. 9. Test the script. Try pulling the phone line from the back of the modem or such for enough time to trigger the script. If I can help with any other ADSL stuff please let me know. Use the email address hillaa@hotmail.com. Paul and I have got a few more scripts for working with dynamic DNS services and the like that you might find useful as well. As for the tun0 interface keeping old IP addresses on it - I have seen this problem on my system and seem to remember that there's an option you can put in ppp.conf to get rid of it. I don't have the option on my system however so I'm not sure what it is. Anyone else? Good luck! Aaron Hill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message