🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.internet.wireless
Article #41

Re: Haldbridge modem & DD-WRT DHCP problem

#41
From: Jeff Liebermann
Date: Sun, 29 Jun 2008 20:44
66 lines
3830 bytes
On Sun, 29 Jun 2008 11:13:09 -0700 (PDT), BigAl.NZ@gmail.com wrote:

>I think this keep alive script is what I want:
>http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Automatic_Connection_Repair_.28always_on.sh.29

Good find.  That seems to be exactly what you're looking for:

>But it doesnt seem to work...how often is it sending the pings? (I am
>not familir with these scripts)

Learn Borne shell or BASH scripting.  You won't regret it.  The
minimal basics:
<http://ooblick.com/text/sh/>
I added some comments and debug.  It should run with the comments.

================== Cut Here ===================
#!/bin/sh
# set -x       # remove comment symbol for debugging
INTERVAL=10    # ping every 10 seconds
PACKETS=1      # number of ping packets
IFACE=vlan1    # vlan1 is the WAN interface in DD-WRT.

# get PID (Process ID) number for DHCP client daemon.
UDHCPC="udhcpc -i vlan1 -p /var/run/udhcpc.pid -s /tmp/udhcpc"

ME=`basename $0`   # get name of this script.

# check if the script is already running.
RUNNING=`ps | awk '/'"$ME"'/ {++x}; END {print x+0}'`

# Bail out if running more than 3 copies.  No clue why.   
if [ "$RUNNING" -gt 3 ]; then
   echo "Another instance of \"$ME\" is running"
   exit
fi

while sleep $INTERVAL   # run script every 10 seconds
do
   # set tarket to default gateway IP address.
   TARGET=`ip route | awk '/default via/ {print $3}'`

# ping once and get the response.
   RET=`ping -c $PACKETS $TARGET 2> /dev/null | awk '/packets
received/ {print $4}'`

# If ping fails, send RELEASE signal to the DHCP client process.
   if [ "$RET" -ne "$PACKETS" ]; then
      echo Ping failed, releasing IP address: $IFACE
      kill -USR2 `cat /var/run/udhcpc.pid` 2> /dev/null
      # ensure udhcpc is not running
      killall udhcpc 2> /dev/null
      echo Renewing IP address: $IFACE
      $UDHCPC
      echo Waiting 10 s ...
      sleep 10
   else
      echo Network is up via $TARGET
   fi
done
================== Cut Here ===================

-- 
Jeff Liebermann     jeffl@cruzio.com
150 Felker St #D    http://www.LearnByDestroying.com
Santa Cruz CA 95060 http://802.11junk.com
Skype: JeffLiebermann     AE6KS    831-336-2558
Technical Details
Message-ID: <9qrf64l09hlc0nuv9flj8qfvkicr9mihpk@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
References: <0d11a378-6e97-4bdd-9c1f-1a61800b6e9c@s21g2000prm.googlegroups.com> <8r3a649gger5v6u8hj9ijgme5vaua8h1qu@4ax.com> <65a50c62-674e-4c94-903a-809dbe210948@i36g2000prf.googlegroups.com> <juhb64th9rp680grc4nmjchue3jbh2fgf5@4ax.com> <27dcc768-a498-455f-b601-f5ffe4fe90fa@y22g2000prd.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 104fd2,396ccc4f2596477e
X-Google-Thread: faa3c,396ccc4f2596477e
X-Google-Attributes: gid104fd2,gidfaa3c,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 29 Jun 2008 15:44:37 -0500
From: Jeff Liebermann <jeffl@cruzio.com>
Newsgroups: alt.internet.wireless,24hoursupport.helpdesk
Subject: Re: Haldbridge modem & DD-WRT DHCP problem
Date: Sun, 29 Jun 2008 13:44:36 -0700
Message-ID: <9qrf64l09hlc0nuv9flj8qfvkicr9mihpk@4ax.com>
References: <0d11a378-6e97-4bdd-9c1f-1a61800b6e9c@s21g2000prm.googlegroups.com>  <8r3a649gger5v6u8hj9ijgme5vaua8h1qu@4ax.com> <65a50c62-674e-4c94-903a-809dbe210948@i36g2000prf.googlegroups.com>  <juhb64th9rp680grc4nmjchue3jbh2fgf5@4ax.com> <27dcc768-a498-455f-b601-f5ffe4fe90fa@y22g2000prd.googlegroups.com>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 66
X-Trace: sv3-ydAL4/pPafTv7E1j1898/U+YZ3pMoNE+cHheMPEZzqe/xFmsGbS/9iOy8ZTveMkA0NO2QVHHIci6E9g!IS+GCmQm90uhVsqU7EzuWxN9SrWBGq7CIrQgxLQ7jumRasiLaJy7e+seY7eFoDTB8dV/Zn9xDBKg!Rm1dSw==
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.39