1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WAN monitor/DHCP reset script

Discussion in 'Tomato Firmware' started by lfjeff, Feb 11, 2011.

  1. lfjeff

    lfjeff Networkin' Nut Member

    For some reason, my ISP sometimes drops my connection and it was taking forever for the router to reset itself. I created this script which seems to have solved the problem. Perhaps it will be useful to others:

    GW=`nvram get wan_gateway`
    IF=`nvram get wan_ifname`
    if ! ping -q -c 5 -w 30 $GW
      logger "Lost WAN connection to $GW, attempting to renew DHCP..."
      udhcpc -i $IF -q -S
    I have set up the script under "Administration -> Scheduler -> Custom 1" and set it to run every minute. It monitors the local WAN gateway and tries to renew the DHCP connection if it is unable to ping.
  2. bigclaw

    bigclaw Network Guru Member

    I recently switched to Comcast and started experiencing a similar problem. Hopefully this script will solve it for me as well. Great job!
  3. zorkmta

    zorkmta LI Guru Member

    Thanks to share, i will try it

Share This Page