PPTP client re-dial?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
soundbite
DD-WRT Novice


Joined: 01 Dec 2009
Posts: 5

PostPosted: Sat Oct 02, 2010 19:35    Post subject: PPTP client re-dial? Reply with quote
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.
Sponsor
soundbite
DD-WRT Novice


Joined: 01 Dec 2009
Posts: 5

PostPosted: Sat Oct 02, 2010 20:19    Post subject: Reply with quote
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

fi
sleep 20
done
soundbite
DD-WRT Novice


Joined: 01 Dec 2009
Posts: 5

PostPosted: Sun Oct 03, 2010 1:16    Post subject: Reply with quote
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...
713lucid
DD-WRT Novice


Joined: 07 Oct 2010
Posts: 2

PostPosted: Thu Oct 07, 2010 1:59    Post subject: Reply with quote
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.
cougarmaster
DD-WRT Novice


Joined: 09 Jun 2010
Posts: 5

PostPosted: Fri Dec 24, 2010 7:00    Post subject: Reply with quote
I have these syntax errors not a scripter how to fix it?

sh: eval: line 14: syntax error: "done" unexpected (expecting "then")

#!/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

fi
sleep 20
done
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum