You are not logged in.
Hi All,
I have created a new script for connecting to my ISP and then keep it alive (it runs on my Arch router), I will be happy to hear comments and suggestions, enjoy.
Note: This script uses the tcping utility (http://www.linuxco.de/tcping/tcping.html)
Replace USER with your ISP username
Replace DOMAIN with your PNS domain name
Replace DNS IP's with the ones of your ISP
#!/bin/bash
cable_connect()
{
/etc/rc.d/network restart
sleep 1
logger "Cable_connect: settings vars..."
USERNAME=USER
CABLEGW=`/sbin/route -n | grep ^0.0.0.0 | awk '{print $2}'`
PNS=`host DOMAIN | awk '{print $4}' | tail -1`
sleep 1
logger "Cable_connect: fixing routes..."
/sbin/route add -host $PNS gw $CABLEGW
sleep 1
/sbin/route del default
sleep 1
logger "Cable_connect: connecting..."
/usr/sbin/pptp $PNS user $USERNAME mtu 1460 mru 1460 defaultroute usepeerdns noauth
sleep 1
echo "nameserver 192.11.216.31" > /etc/resolv.conf
echo "nameserver 192.11.24.4" >> /etc/resolv.conf
echo "nameserver 194.9.1.55" >> /etc/resolv.conf
}
logger "Cable_connect: Connecting..."
cable_connect
while [ 1 ]
do
logger "Cable_connect: Sleeping..."
sleep 300
logger "Cable_connect: Testing connectivity..."
if tcping -q -t 10 www.google.com 80 ;then
logger "Cable_connect: Connection is alive."
else
logger "Cable_connect: Connection Failure, reconnecting..."
cable_connect
fi
done
Last edited by daf666 (2008-02-29 15:59:20)
Offline