Reconnect WAN Script: reconnect until a certain IP range is match

Discussion in 'Tomato Firmware' started by remlei, Nov 6, 2013.

  1. remlei

    remlei Networkin' Nut Member

    Does anyone had a WAN_UP script for this?

    the scenario is like this, WAN connection will reconnect until a certain IP range is match like I want the certain IP in

    10.100.xx.xx
    10.200.xx.xx

    but not in other else WAN IP address. It will do reconnect (release renew the WAN) the WAN connection until I got the desired IP range

    thanks
     
  2. Almaz

    Almaz Networkin' Nut Member

    Use the above script as a template and modify

    Code:
    maxPloss=99
    pingtime=15
    ploss=101
    trip="10.100.1.100"
    if [ "$1" != "" ]; then
        trip="$1"
    fi
    if [ "$2" != "" ]; then
        pingtime="$2"
    fi
        ploss=`ping -q -w $pingtime $trip | grep -o "[0-9]*%" | tr -d %` > /dev/null 2>&1
    if [ "$ploss" -gt "$maxPloss" ]; then
        logger No response from $trip
        service wan stop
    else
        service wan start   ##-------> add more conditions otherwise you'll loose WAN for 2-3 seconds if it was already started[/INDENT]
    fi
    
     
    Last edited: Nov 7, 2013
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice