Date: Fri, 28 Jun 2002 14:22:39 +1000 (EST) From: "Aaron Hill" <fbsdlist@futureuse.net> To: <freebsd-questions@FreeBSD.ORG> Cc: <bsd-freak@mbox.com.au> Subject: 2nd: Re: PPPoE flakiness Message-ID: <42832.203.11.225.5.1025238159.squirrel@www.futureuse.net>
next in thread | raw e-mail | index | archive | help
Are we not allowed to send shell scripts to FreeBSD questions? My response was bounced for this reason ... <freebsd-questions@FreeBSD.ORG>: 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42832.203.11.225.5.1025238159.squirrel>