What's new

L2TP VPN - delayed start possible?

  • 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!

slippman

New Around Here
Hi, I want to use L2TP vpn as it´s good enough and has no speed penalty om my 100mbit connection. It works fine on my new AX58U with 386.2_beta1, but if I reboot WAN is not working. Enabling/disabling WAN manually in that case restores it. I assume the startup of the vpn client needs to delayed until WAN/NTP is fully up... is there a way?

(attaching logs)

Thanks!
 

Attachments

  • syslog.txt
    26.6 KB · Views: 132
Hi, I want to use L2TP vpn as it´s good enough and has no speed penalty om my 100mbit connection. It works fine on my new AX58U with 386.2_beta1, but if I reboot WAN is not working. Enabling/disabling WAN manually in that case restores it. I assume the startup of the vpn client needs to delayed until WAN/NTP is fully up... is there a way?

(attaching logs)

Thanks!

Circa 2017

and then this version... You will need to edit the PASSWD and USERNAME credentials and don't define any L2TP sessions in the GUI
(You will be able to see the connection in the GUI after the script has successfully connected! ;) )

Code:
#!/bin/sh

logger -st "($(basename $0))" $$ "PPTP Client connection request....'$@'"

# Should we also 'nvram unset vpnc_dut_disc' in init-start...since we are now creating a GUI profile??
#

# NOTE: If there is no matching PPTP Client profile, then clearly the VPN Status tab in the GUI will be empty :-(
#
#        nvram get vpnc_clientlist
#
# However we will spoof the Profile!  and create one called 'Dynamic' ;-)

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

fi

if [ "$1" == "del" ];then
    echo -e "\a***ERROR arg1 cannot be 'del' - should be PPTP_server_IP then 'del'"
    exit 99

fi

# Use the server specified (DNS name or I/P address)
SERVER=$1                                                # Server

PROTOCOL="L2TP"                                            # PPTP or L2TP - use uppercase
PASSWD="?"
USERNAME="xxxxxxxxxxxxxxxx"

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

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

# Create a temporary Profile for the GUI...Should we set the Profile password to an invalid value to gaurantee it won't auto start @Boot?? ;-)
TAG="<Dynamic-"$(basename $0)">"$PROTOCOL">"$SERVER">"$USERNAME">"$PASSWD
        
if [ "$2" == "del" ];then
        service stop_vpncall
        sleep 2
        PPTP_Profiles=$(echo `nvram get vpnc_clientlist` | sed 's/<Dynamic.*//')        # Tacky!! 'Dynamic' desc may not be at the end!
        nvram set vpnc_clientlist="$PPTP_Profiles"
        # vpn_dut_disc=1 when the PPTP is disconnected??? (GitGub search will only find 'dut_disc' - see '/release/src/router/rc/vpnc.c')
        nvram set vpnc_state_t="3"
        logger -st "($(basename $0))" $$ "PPTP Client termination request complete.."
else
        
        if [ -z $(nvram get vpnc_clientlist | grep -o $TAG) ];then
           PPTP_Profiles=$(nvram get vpnc_clientlist)
           nvram set vpnc_clientlist="${PPTP_Profiles}$TAG"                                    # Create the Dynamic Profile in the GUI
        fi
        service restart_vpncall                                                               
        sleep 5
        
        #cat /tmp/ppp/vpnc_options.pptp
        nvram set vpnc_state_t="2"                                                            # Set the Dynamic Profile in the GUI to 'connected' state
        nvram unset vpnc_dut_disc                                                            # Prevent auto start @Boot??
        logger -st "($(basename $0))" $$ "PPTP Client request complete.."
fi
 

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