|
Dimensione: 1859
Commento:
|
Dimensione: 2053
Commento:
|
| Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
| Linea 6: | Linea 6: |
| {{{ | |
| Linea 8: | Linea 7: |
| (Please find here the latest version https://github.com/ninuxorg/misc_tools/tree/master/adsl_check ) {{{#!bash |
|
| Linea 20: | Linea 22: |
| 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)) | 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 |
| Linea 32: | Linea 35: |
| Linea 36: | Linea 38: |
| {{{ |
{{{#!bash |
| Linea 52: | Linea 53: |
| }}} | |
| Linea 53: | Linea 55: |
| Execution files permissions {{{#!bash chmod +x /bin/adsl_check chmod +x /etc/init.d/adsl_check |
|
| Linea 58: | Linea 64: |
| Linea 61: | Linea 66: |
| Linea 66: | Linea 70: |
| Linea 71: | Linea 74: |
| Linea 77: | Linea 79: |
| Linea 80: | Linea 81: |
| Linea 85: | Linea 85: |
| Linea 88: | Linea 87: |
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
(Please find here the latest version https://github.com/ninuxorg/misc_tools/tree/master/adsl_check )
#!/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
doneCreate the init script /etc/init.d/adsl_check
#!/bin/sh /etc/rc.common
START=50
start() {
adsl_check &
}
stop() {
killall adsl_check
}Execution 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 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






