Auto-connecting to a SoftEther VPN

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
stevesobol
Posts: 6
Joined: Mon May 11, 2015 12:20 am

Auto-connecting to a SoftEther VPN

Post by stevesobol » Mon May 11, 2015 7:07 am

Is there any documentation on auto-connecting a server running Windows Server 2012 R2? Basically I want to automatically connect to the VPN when the server is restarted.

I put the following into a .cmd file which I set up to execute at boot time by adding it to the Registry's HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run key:

vpncmd localhost /Client /OUT:logfile.txt /HUB:MyVirtualHubName /CMD AccountConnect MyVPNName

logfile.txt shows that the client connected successfully but when I actually log on to the server, I'm no longer connected. I'm wondering if that may be because I'm NOT logged in when the command runs...?

Thanks

colapig
Posts: 148
Joined: Tue Oct 14, 2014 5:36 am

Re: Auto-connecting to a SoftEther VPN

Post by colapig » Mon May 11, 2015 11:27 am

You can try to create a connection shortcut (just pull the connection from the client manager to the desktop). Then put the shortcut to the startup group. I have never tried, but I think it works.

stevesobol
Posts: 6
Joined: Mon May 11, 2015 12:20 am

Re: Auto-connecting to a SoftEther VPN

Post by stevesobol » Mon May 11, 2015 3:52 pm

Yeah, I certainly could, and I might try it.

What I did is similar to what you suggested.

Problem is, I could restart the server and not log in for days or a week or two. MySQL and Internet Information Services start automatically when I restart, as does the FTP service, so I don't *need* to log in. I'm only connecting to the VPN so I can manage the server using RDP - there is no way I'm leaving RDP access open to the entire world.

Right now I'm trying to get the VPN working using L2TP or SSTP. I have a Mac mini that connects via L2TP (support is built in to OS X), and I can write an AppleScript that connects at boot time, and I've googled and found that I should be able to do the same with a Windows native VPN connection.

I'm going to update this post as soon as I find a workable solution.

Thanks for your help!

thisjun
Posts: 2458
Joined: Mon Feb 24, 2014 11:03 am

Re: Auto-connecting to a SoftEther VPN

Post by thisjun » Thu May 21, 2015 6:00 am


rosch
Posts: 3
Joined: Thu May 21, 2015 8:39 am

Re: Auto-connecting to a SoftEther VPN

Post by rosch » Thu May 21, 2015 9:32 am

If you want to auto-connect a Mac, then you can use ControlPlane which runs a login script to the VPN:
http://www.controlplaneapp.com/

--
-- Applescript to start from 'controlplane' to fire VPN automatically
--
--on idle
tell application "System Events"
tell current location of network preferences
set VPN to "My VPN"
set VPNactive to connected of current configuration of service VPN
if not VPNactive then
connect service VPN
end if
end tell
end tell
--end idle

If you want to auto-connect a server to another server, you can use a cascade connection. This way, the client-side server will be able to route traffic from the local network to the VPN.

stevesobol
Posts: 6
Joined: Mon May 11, 2015 12:20 am

Re: Auto-connecting to a SoftEther VPN

Post by stevesobol » Thu May 21, 2015 3:29 pm

I'm not worried about the Mac anymore, and here's why:

My Mac starts up and automatically logs in as me.

I found an AppleScript on the web somewhere (I should probably dig up the URL) that automates the process of connecting to a VPN. I've set up my SoftEther connection as an L2TP VPN on the Mac and it works great. The only thing I found I needed to do was put in a 120-second delay because if the script tries to connect immediately upon login, it fails (I'm guessing because the network interfaces aren't all up and running at that particular moment).

What I'm focusing on now is the Windows server. When it reboots, I may or may not log in immediately afterwards. I'm going to look at some of the suggestions people have made recently, and see if I can find one that works.

[EDIT: but even after I put in the delay, it still doesn't work consistently so I am going to try ControlPlane instead]
Last edited by stevesobol on Thu May 21, 2015 6:48 pm, edited 1 time in total.

stevesobol
Posts: 6
Joined: Mon May 11, 2015 12:20 am

Re: Auto-connecting to a SoftEther VPN

Post by stevesobol » Thu May 21, 2015 3:35 pm

Setting the connection as a "Startup Connection" worked on the Windows server! Thank you!!

stevesobol
Posts: 6
Joined: Mon May 11, 2015 12:20 am

Re: Auto-connecting to a SoftEther VPN

Post by stevesobol » Thu May 21, 2015 7:22 pm

Even using ControlPlane, after rebooting and ending up at the desktop, I'm still getting messages that the L2TP server isn't responding. :(

I did discover that I had an old, broken script set up as a Startup Item. I removed that script from the list of Startup items. In Control Plane, I have a nested context - the first trigger is that Finder has to load (remember, my Mac logs me in automatically at boot time), and the second is that the Ethernet network interface has to come up.

I just restarted my Mac. The script ran as expected, but I still got the message "The L2TP-VPN server did nt respond. Try reconnecting. If the problem continues, verify your settings and contact your Administrator."

There were other apps/services that were starting up as the computer tried to connect me to the VPN, but I'm not sure why or even if that would make a difference.

stevesobol
Posts: 6
Joined: Mon May 11, 2015 12:20 am

Re: Auto-connecting to a SoftEther VPN

Post by stevesobol » Thu May 21, 2015 7:26 pm

After the VPN connection failed, I tried starting it manually and it came up within literally 2-3 seconds.

Then I rebooted and got the same message, that the VPN server didn't respond.

Any idea?

thisjun
Posts: 2458
Joined: Mon Feb 24, 2014 11:03 am

Re: Auto-connecting to a SoftEther VPN

Post by thisjun » Thu Sep 07, 2017 7:58 am

>kjawdaj

VPN Gate connection is temporal. So start up connection doesn't work with.

Post Reply