DSL Modem
I seemed to be having lots of reliability problems using the D-Link modem for my ADSL access so I decided to change to a DSL modem. I chose the Draytek Vigor 120 ADSL2+ as it had good reviews. Unlike the D-Link mode, that uses DHCP to pass the external IP address, this operates as a DSL modem with the driver software creating a dsl0 device that is independent from the ethx device that the modem is physically connected to. The login parameters are defined in the operating system software rather than the modem.
I find that the modem works very well, giving me good access speeds but it does need some monitoring software as the system does not automatically reconnect if the connection is dropped. I have created the following
Every 5 mins I run dsl_test
# dsl_test
#
interface=dsl0
#
dynip=`/sbin/ifconfig | grep -A 5 $interface | awk '/inet/ { print $2 } ' | sed -e s/addr://`
if [ -z $dynip ]; then
echo "$interface is blank"
/sbin/ifup $interface
else
echo "not blank"
# interface exists so lets test to see if the DNS entries are correct
/usr/local/net_test/dns_test
fi
This does 2 things .. if there is no dsl0 interface then it issues ifup dsl0 to bring the link back up. If the interface is up then it checks the dns entries to see if my dynamic ip address has changed and I haven't correctly updated the dynamic DNS entry.
dns_test does the following
#
interface='dsl0'
#echo "interface $interface"
#
localip=`/sbin/ifconfig | grep -A 5 $interface | awk '/inet/ { print $2 } ' | sed -e s/addr://`
#echo "local ip addr = " $localip
#
dnsip=`dig @8.8.4.4 mstubbs.co.uk +short`
#
if [ "$localip" == "$dnsip" ]
then
i=1
# echo "match"
else
echo "Do not match"
logger "$0 - Failed match localip = $localip dnsip = $dnsip"
case "$localip" in
10.*) ;;
172.1[6-9].* | 172.2[0-9].* | 172.3[0-1].*) ;;
192.168.*) ;;
"") echo Local IP address
;;
*) (
# sleep 5
/usr/local/ddns/my_afraid_update
logger "$0 - Finished trying to update DNS entry"
) &
;;
esac
#
fi
If the local and remote IP addresses don't match I try to update my dynamic IP address. I now use afraid and my update program is :
#
curl -s --retry 5 "http://freedns.afraid.org/dynamic/update.php?xxxxxxxxxxxxxxxxxxxxxxxxxx"
The xxxxxxxxxxx should be replaced by the update string you get from the afraid website
- Log in to post comments
