Italiano English
Modifica History Actions

Differenze per "adsl_check"

Differenze tra le versioni 2 e 3
Versione 2 del 2011-11-25 12:13:59
Dimensione: 1859
Autore: Marco
Commento:
Versione 3 del 2011-11-25 12:16:36
Dimensione: 1847
Autore: Marco
Commento:
Le cancellazioni sono segnalate in questo modo. Le aggiunte sono segnalate in questo modo.
Linea 6: Linea 6:
{{{
{{{#!bash
Linea 32: Linea 31:
Linea 36: Linea 34:
{{{
{{{#!bash
Linea 52: Linea 49:
Linea 58: Linea 54:
Linea 61: Linea 56:
Linea 66: Linea 60:
Linea 71: Linea 64:
Linea 77: Linea 69:
Linea 80: Linea 71:
Linea 85: Linea 75:
Linea 88: Linea 77:

Adsl Check

This guide explain how to configure your router for automatic delete/insert the 0.0.0.0/0.0.0.0 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

#!/bin/sh

# Release under the GPLv3 Licence
#
# @AUTHORS: Clauz (clauz@ninux.org), Hispanico (marco.giuntini@gmail.com), Stefano (stefano@ninux.org)
# 

IP_PING=78.47.48.238 #Address to check ADSL Connection
ADSL_GW='192.168.1.254' #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
else
        (ip r s |grep -F $ADSL_GW >/dev/null) && ip route del default via $ADSL_GW
fi
sleep 50
done

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

#!/bin/sh /etc/rc.common
START=50

start() {

adsl_check &

}

stop() {

killall 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 olsrd_dyn_gw.so.0.5
        option  Interval 50
        option  Ping  78.47.48.238

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