Delay PPTP vpn start

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

skeal

Part of the Furniture
I found that the starting of my PPTP vpn during the boot process interferes with the loading of dnscrypt and ends up without dns after the boot. Can anyone tell me how to make the PPTP vpn wait another 60 seconds or what ever? I'm pretty certain this will fix me up.
 

Martineau

Part of the Furniture
I found that the starting of my PPTP vpn during the boot process interferes with the loading of dnscrypt and ends up without dns after the boot. Can anyone tell me how to make the PPTP vpn wait another 60 seconds or what ever? I'm pretty certain this will fix me up.

I used this script back in the day before PPTP was compromised! :eek:

/jffs/scripts/UP_PPTP.sh

Code:
#!/bin/sh

logger -s -t "($(basename $0))" $$ "PPTP Client connection requested....'[email protected]'"

if [ -z "$1" ];then
    logger -st "($(basename $0))" $$ "***ERROR missing arg1 PPTP_server_IP"
    echo -e "\a"
    exit 99
fi

nvram set vpnc_heartbeat_x="$1"       # PPTP Server to connect to

nvram set vpnc_dnsenable_x="1"
nvram set vpnc_pppoe_passwd="xxxxxxxxxx"
nvram set vpnc_pppoe_username="uuuuuuuuuu"
nvram set vpnc_pptp_options_x="+mppe-128"       # HMA explicitly rather than 'Auto'
nvram set vpnc_proto="pptp"

service restart_vpncall

sleep 20

logger -s -t "($(basename $0))" $$ "PPTP Client request complete."

So in init-start
Code:
sleep 180
/jffs/scripts/UP_PPTP.sh   pptp_server_IP

where pptp_server_IP is replaced by the actual I/P address or DNS name of the remote PPTP server!

or alternatively in wan-start after a suitable lesser delay such as 60 secs
 
Last edited:

skeal

Part of the Furniture
Hey @Martineau I set this up and rebooted but at the end of the boot in the logs is the notation: PPTP: Unknown host pptp_server_IP

It eventually hangs up. I have to activate the tunnel and then of course it starts fine.

Any ideas? I went with 180 seconds in the init-start script by the way.
 

john9527

Part of the Furniture
Hey @Martineau I set this up and rebooted but at the end of the boot in the logs is the notation: PPTP: Unknown host pptp_server_IP

It eventually hangs up. I have to activate the tunnel and then of course it starts fine.

Any ideas? I went with 180 seconds in the init-start script by the way.

He used 'pptp_server_IP' as a placeholder for you to substitute the actual IP of your server.
 

Martineau

Part of the Furniture
He used 'pptp_server_IP' as a placeholder for you to substitute the actual IP of your server.

Thanks!...wonder if he also actually changed 'xxxxxxxxxx' and 'uuuuuuuu' to appropriate values :rolleyes:
 

Martineau

Part of the Furniture
Hey @Martineau I set this up and rebooted but at the end of the boot in the logs is the notation: PPTP: Unknown host pptp_server_IP

You don't have to reboot to test the script...simply run it from the command line to validate the server and Username/password combo.
 

john9527

Part of the Furniture
Thanks!...wonder if he also actually changed 'xxxxxxxxxx' and 'uuuuuuuu' to appropriate values :rolleyes:
Wasn't trying to jump in on your work (you do great work supporting users with your scripts). Just trying to save him some frustration...

PS - if he didn't change the other strings....he has a hint now :)
 

skeal

Part of the Furniture
Hey thank you for help. The vpn seems to execute early in the boot. This script when configured right...lol works but it doesn't matter something else is starting the vpn earlier than this script is delayed for. Help please kind sirs!
 

Martineau

Part of the Furniture
Hey thank you for help. The vpn seems to execute early in the boot. This script when configured right...lol works but it doesn't matter something else is starting the vpn earlier than this script is delayed for. Help please kind sirs!

Do you have a PPTP profile defined? - if so then delete it - preferably all of them!

The rationale behind the current script is that if there is no PPTP profile, then @boot nothing can 'accidentally' start it! until you explicitly manually initiate the connection. Have you noticed that there is no PPTP 'Start with Wan' option like there is with OpenVPN Clients? - clearly the firmware tenaciously 'remembers' which PPTP profile was ACTIVE when the Router goes down and automatically reconnects @boot.

The downside is that when the PPTP connection is UP, you have no way of knowing this via the GUI.

P.S. You can create a dynamic Profile, but sadly the status in the GUI for this spoofed PPTP Profile is never set to 'connected', but it acts as an eye-catcher to prove the script ran!
 
Last edited:

skeal

Part of the Furniture
I understand and this makes perfect sense. Thank-you for the explanation of what is going on.
 

skeal

Part of the Furniture
Once again you guys rule!! Script runs real well in init-start at 180 second delay. Thank-you for your tenacious support all kidding aside!
 

skeal

Part of the Furniture
Hey you smart guys! I have a question? After getting this script up and running the router rebooted real well. Since then any time I make a change in my routers settings it seems anywhere in the router when I apply the setting my router looses it's dns link some how. If I reboot the router we are good to go. What is being restarted when I apply a setting that leaves out updating dnscrypt which functions as my dns? These setting changes are not ones that require a reboot to commit.

@Martineau do you have any ideas?
 

skeal

Part of the Furniture
^^ Help??
 

skeal

Part of the Furniture
Do you have a PPTP profile defined? - if so then delete it - preferably all of them!

The rationale behind the current script is that if there is no PPTP profile, then @boot nothing can 'accidentally' start it! until you explicitly manually initiate the connection. Have you noticed that there is no PPTP 'Start with Wan' option like there is with OpenVPN Clients? - clearly the firmware tenaciously 'remembers' which PPTP profile was ACTIVE when the Router goes down and automatically reconnects @boot.

The downside is that when the PPTP connection is UP, you have no way of knowing this via the GUI.

P.S. You can create a dynamic Profile, but sadly the status in the GUI for this spoofed PPTP Profile is never set to 'connected', but it acts as an eye-catcher to prove the script ran!
Hey I was wondering if you can help me with a problem that has popped up since I added the script. My Dns goes down if I make any sort of setting change in webui. To fix a reboot is a must it seems. Any ideas?
 

john9527

Part of the Furniture
Hey I was wondering if you can help me with a problem that has popped up since I added the script. My Dns goes down if I make any sort of setting change in webui. To fix a reboot is a must it seems. Any ideas?
How did you add DNSCrypt support? DNSCrypt support is usually tightly tied to dnsmasq....and dnsmasq can be restarted for multiple reasons including changes made through the gui. You may need to add add custom code to dnsmasq.postconf to try and handle the restart/reconfig for dnscrypt.

As an aside, when I did a native dnscrypt integration into my fork, it took about 500 lines of router code outside of the dnscrypt functional code.....over half that was to handle error recovery and reconfig cases.
 

skeal

Part of the Furniture
I just followed the post on installing dnscrypt it worked flawlessly until I added that script to delay my pptp vpn start.
 

skeal

Part of the Furniture
Hey @john9527 any ideas how to correct this? I'm a script kitty I know nothing about making one from scratch. I can follow directions very well I just need a little help.
 

john9527

Part of the Furniture
I had actually been thinking a little about this....some of the gui options cause a restart of the WAN, or of a significant portion of the services (essentially a router code reboot, leaving out the kernel and the running of init-start). So, what you may be seeing is essentially the same problem as you originally had.

We may be better served by trying to figure out a 'fix' for the original problem, instead of the delayed pptp workaround. Can you turn off the init-start changes, then post a syslog from the failed boot to a file sharing site so we can take a look?
 

skeal

Part of the Furniture
Sorry @john9527 I have no clue how to post my log results to a file sharing site. Never done this before. Can you help me get there please?

Edit: @john9527 I have pastebin setup I'll post my boot up log soon. Am I correct if I remove init-start file from jffs/scripts and reboot, the log that is generated is what you want right?
 
Last edited:

skeal

Part of the Furniture

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top