Italiano English
Modifica History Actions


Adsl Check

This guide explain how to configure your router for automatic delete/insert the and the static default route if your adsl is temporarily fault.

Create adsl_check script

Create the file /bin/adsl_check and insert the follow script

(Please find here the latest version )


# Release under the GPLv3 Licence
# @AUTHORS: Clauz (, Hispanico (, Stefano (

IP_PING= #Address to check ADSL Connection
ADSL_GW='' #Address of ADSL Gateway
RT_TABLE=check #Name of the new routing table for check
RT_TABLE_NUM=201 #Number of the routing table for check

grep $RT_TABLE /etc/iproute2/rt_tables || (echo $RT_TABLE_NUM $RT_TABLE >> /etc/iproute2/rt_tables)
ip route add table $RT_TABLE default via $ADSL_GW

(ip rule show | grep -F $IP_PING) || ip rule add to $IP_PING table $RT_TABLE 

while [ 1 ]; do
if ping -q -c 1 $IP_PING >/dev/null 2>/dev/null; then
        (ip r s |grep -F $ADSL_GW >/dev/null) || ip route add default via $ADSL_GW
        (ip r s |grep -F $ADSL_GW >/dev/null) && ip route del default via $ADSL_GW
sleep 50

Create the init script /etc/init.d/adsl_check

#!/bin/sh /etc/rc.common

start() {

adsl_check &


stop() {

killall adsl_check


Set files permissions

chmod +x /bin/adsl_check
chmod +x /etc/init.d/adsl_check

Install and Configure olsr_dyn_gw Plugin

Install olsr_dyn_gw plugin

opkg update
opkg install olsrd-mod-dyn-gw

Add the follow line in olsrd.conf

config  LoadPlugin
        option  library
        option  Interval 50
        option  Ping

Enable and Start

Reload olsrd

/etc/init.d/olsrd stop
/etc/init.d/olsrd start

Enable and start adsl_check script

/etc/init.d/adsl_check enable
/etc/init.d/adsl_check start