Posted: Sat Oct 02, 2010 19:35 Post subject: PPTP client re-dial?
I use a Cisco IP phone to connect via VPN to our main office. The PPTP VPN client in DD-WRT worked beautifully for me when I lived in the US. However, I recently relocated to the Carribean where the DSL conks out randomly a couple times each week. I come home to find my phone offline, and I have to telnet in and /tmp/pptp_client/vpn/stop and then /tmp/pptp_client/vpn/start, and then I have to unplug my phone for 30 seconds and plug it back in again for it to reconnect to our Asterisk box. Argh!
Is there a way to get DD-WRT to check for a VPN link and redial if it discovers it's down--without rebooting the entire modem? I saw this thread (http://www.dd-wrt.com/phpBB2/viewtopic.php?p=80725), but it's not designed for the Services/PPTP Client tool. Plus, I haven't been able to figure out how to use it with my router even if I modified it.
I tried using Setup > Basic Setup > Connection Type > PPTP (I wouldn't mind sending all my traffic through the VPN), but it doesn't want to connect (even though http://forum.hidemyass.com/showthread.php?tid=2009) would seem to indicate this should work.
I am running 14896 Mini on a WRT320N. My PPTP server is Windows 2003.
Update--I placed this script in startup...am I on the right track with this? When I execute it manually it seems to do the job. (192.168.3.1 is my remote subnet's router IP.)
#!/bin/sh
while [ 1 ]
do
if ping -c 1 192.168.3.1
then
echo Connected
else
/tmp/pptp_client/vpn stop
/tmp/pptp_client/vpn start
Update: I added the following script at startup, and it seems to be doing the trick so far.
Code:
#!/bin/sh
sleep 90
while [ 1 ]
do
if ! ping -c 1 192.168.3.1; then
/tmp/pptpd_client/vpn stop
/tmp/pptpd_client/vpn start
fi
sleep 20
done
I have a 90 second sleep at the beginning so that it gives the pptp startup script time to initialize before it starts testing for a connection. Does this seem to make sense to everyone, or would you do it differently?
In case you're new to scripts with DD-WRT (as I was), you add a startup script by going to Administration > Commands, pasting the startup script into the text area, and clicking the "Save Startup" button at the bottom. When the screen refreshes, you'll see your script displayed under the heading "Startup" along with an Edit button. If you want to modify the script, click the Edit button, and your script will appear in the text area above. When you're done, click "Save Startup" again, and it will write it back out and update the script file. Nice feature...
Without adding this startup script, I purposely disconnected my VPN connection from the server end. The PPTP client reconnected automatically (as it should) Is this because I am using the VPN version of DD-WRT, or does it stop attempting reconnection after so many tries?
I guess I'm not sure why this is needed, but will certainly add it to my config if it is.