What's new

How to start and stop VPN client from command line?

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

Gemann

New Around Here
Hello, I am looking for a way to start and stop a VPN client on my RT-AC87U with stock WRT from the command line. The goal is to write an app for the Apple TV that lets me easily turn on and off the VPN connection for certain TV channels.

Any pointers towards documentation on command line commands like "service" or a breakdown of important nvram parameters would be greatly appreciated. I have been looking for a couple of days now, but no luck so far.
 
I found the following threads on the Merlin forum:

http://www.snbforums.com/threads/start-stop-openvpn-server-by-command-line.23245/
http://www.snbforums.com/threads/cant-start-openvpn-connection-from-command-line.27413/

RMerlin replied with the following commands:

Code:
service stop_vpnserver1
service start_vpnserver1
service start_vpnclient1​

In my case I have two client connections configured in the GUI which are working correctly. The first one is OpenVPN and the second one is PPTP (for TV streaming).

When I try the command "service start_vpnclient2" I get the following output in the system log:

Dec 20 15:56:54 rc_service: service 10697:notify_rc start_vpnclient2
Dec 20 15:56:55 openvpn[10702]: Options error: You must define CA file (--ca) or CA path (--capath)
Dec 20 15:56:55 openvpn[10702]: Use --help for more information.
I don't understand the OpenVPN error messages since client2 is configured as pptp. Here is what the log looks like when I launch the VPN client successfully from the GUI:

Dec 20 15:59:10 rc_service: httpd 456:notify_rc restart_vpncall
Dec 20 15:59:12 pptp[10781]: pppd 2.4.7 started by admin, uid 0
Dec 20 15:59:13 pptp[10781]: Connect: ppp5 <--> pptp (x.x.x.x)
Dec 20 15:59:14 pptp[10783]: Non-zero Async Control Character Maps are not supported!
Dec 20 15:59:15 pptp[10781]: CHAP authentication succeeded
Dec 20 15:59:15 kernel: mppe_decomp_init[5]: unknown key length
Dec 20 15:59:15 pptp[10781]: local IP address x.x.x.x
Dec 20 15:59:15 pptp[10781]: remote IP address x.x.x.x
Dec 20 15:59:15 pptp[10781]: primary DNS address x.x.x.x
Dec 20 15:59:15 pptp[10781]: secondary DNS address x.x.x.x​

Where can I learn more about the service command? Maybe these commands only work with Merlin as specified (so they might work for Ois)? Any pointers would be greatly appreciated!
 

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