What's new

how to check for pptp vpn client status and restart it on Asuswrt-Merlin?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

jollychang

New Around Here
how to check for pptp vpn client status and restart it?
I want write a crontab for restart pptp vpn client connection


Asuswrt-Merlin
Firmware:380.68_4
RT-AC66U_B1


 
how to check for pptp vpn client status and restart it?

Something like this?

Code:
#!/bin/sh

IFNAME="ppp5"
PASSWD="password"
USERNAME="uuuuuuuu"
SERVER="url.server.pptp"
PROTOCOL="PPTP"             # PPTP or L2TP

nvram set vpnc_proto=$(echo $PROTOCOL | tr '[A-Z]' '[a-z]')  # Must be lowercase?, but Profile uses uppercase?
nvram set vpnc_heartbeat_x=$SERVER
nvram set vpnc_pppoe_passwd=$PASSWD
nvram set vpnc_pppoe_username=$USERNAME
nvram set vpnc_dnsenable_x="1"
nvram set vpnc_pptp_options_x=

if [ "$PROTOCOL" == "PPTP" ];then        # Only required for PPTP?
 nvram set vpnc_pptp_options_x="+mppe-128"
fi


# Restart ACTIVE PPTP/L2TP client
if [ "$(nvram get vpnc_state_t)" == "2" ] || [ ! -z "$(ifconfig $IFNAME 2> /dev/null | grep -o "UP")" ];then
 service restart_vpncall
fi
 
Something like this?

Code:
#!/bin/sh

IFNAME="ppp5"
PASSWD="password"
USERNAME="uuuuuuuu"
SERVER="url.server.pptp"
PROTOCOL="PPTP"             # PPTP or L2TP

nvram set vpnc_proto=$(echo $PROTOCOL | tr '[A-Z]' '[a-z]')  # Must be lowercase?, but Profile uses uppercase?
nvram set vpnc_heartbeat_x=$SERVER
nvram set vpnc_pppoe_passwd=$PASSWD
nvram set vpnc_pppoe_username=$USERNAME
nvram set vpnc_dnsenable_x="1"
nvram set vpnc_pptp_options_x=

if [ "$PROTOCOL" == "PPTP" ];then        # Only required for PPTP?
 nvram set vpnc_pptp_options_x="+mppe-128"
fi


# Restart ACTIVE PPTP/L2TP client
if [ "$(nvram get vpnc_state_t)" == "2" ] || [ ! -z "$(ifconfig $IFNAME 2> /dev/null | grep -o "UP")" ];then
 service restart_vpncall
fi
Thank You!
 

Similar threads

Sign Up For SNBForums Daily Digest

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