1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Console cmd to Start/Stop/Restart OpenVpn/PPTP VPN server

Discussion in 'ASUS Wireless' started by svkviz, Oct 7, 2014.

  1. svkviz

    svkviz New Around Here

    Joined:
    Sep 19, 2014
    Messages:
    5
    Location:
    Slovakia, Kosice
    Hi all,

    can someone help me with console commands to start/stop/restart/status OpenVPN server and PPTP VPN server service? I am not familiar with it and service pptpd_start is not working :/ No luck with google also :/

    Thank you
     
  2. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    28,553
    Location:
    Canada
    First of all, what firmware are you running? The answer is completely different depending on whether you run stock, Asuswrt-Merlin, Tomato, DD-WRT, Padavan's, ...
     
  3. svkviz

    svkviz New Around Here

    Joined:
    Sep 19, 2014
    Messages:
    5
    Location:
    Slovakia, Kosice
    my bad :/

    sorry for that, of course it is different.
    it is your latest released firmware 376.47 merlin build in RT-N66U device.

    thx for your help.
     
  4. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    28,553
    Location:
    Canada
    OpenVPN server 1 (change the number for the second instance):
    Code:
    service stop_vpnserver1
    service start_vpnserver1
    
    PPTPD:
    Code:
    service stop_pptpd
    service start_pptpd
    
     
  5. svkviz

    svkviz New Around Here

    Joined:
    Sep 19, 2014
    Messages:
    5
    Location:
    Slovakia, Kosice
    Could you pls check one more time that code for start/stop pptp vpn server below is ok? When i check status at web gui after service start_pptpd, pptp vpn server is still stopped and i can not connect to it. When i start it from web gui, i havo no problem with connection. Code for start/stop OpenVpn server is working fine.

    thanks.
     
  6. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    28,553
    Location:
    Canada
    If the service is disabled then you won't be able to start it this way. You have to enable it first:

    Code:
    nvram set pptpd_enable=1
    nvram commit
    
     
  7. svkviz

    svkviz New Around Here

    Joined:
    Sep 19, 2014
    Messages:
    5
    Location:
    Slovakia, Kosice
    Well, i`ve tried to enable the service first:

    Code:
    nvram set pptpd_enable=1
    nvram commit
    
    and then start the service

    Code:
    service pptpd_start
    the result is that, i still cannot connect to pptp server while the VPN SERVER TAB is indication that PPTP server IS running. VPN STATUS TAB is showing that PPTP server IS NOT running. When i reenable PPTP server on VPN SERVER TAB, i can connect normally. Maybe some other settings must be enabled???

    thank`s for help.
     
  8. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    28,553
    Location:
    Canada
    Read the command you typed, and re-read my post. You didn't type it correctly.
     
  9. lifeowl

    lifeowl New Around Here

    Joined:
    Apr 12, 2017
    Messages:
    3
    What are the commands for starting/stopping a VPN client on the stock firmware(3.0.0.4.380_7378)? I've tried:

    Code:
    service start_vpnclient5
    But this yields the following in the logs:

    Code:
    Apr 12 11:13:12 rc_service: service 1786:notify_rc start
    Apr 12 11:13:17 rc_service: service 1787:notify_rc start
    Apr 12 11:13:26 rc_service: service 1790:notify_rc start_vpnclient5
    Apr 12 11:13:27 openvpn[1804]: OpenVPN 2.3.2 arm-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Mar 15 2017
    Apr 12 11:13:27 openvpn[1804]: ERROR: username from Auth authfile 'up' is empty
    Apr 12 11:13:27 openvpn[1804]: Exiting due to fatal error
    
    I noticed that when activating the VPN via the web gui, an /etc/openvpn directory is created with the vpnclient5 info, including an 'up' file and the client.ovpn file, etc. Once I deactivate it, that directory seems to go away. So I'm guessing I need to run a few more commands to mimic this behavior.

    Thanks!
     
  10. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    28,553
    Location:
    Canada
    I would recheck the configuration, especially the username/password for that client. Running start_vpnclient5 will take care of populating the appropriate directories within /etc/openvpn/ .
     
  11. lifeowl

    lifeowl New Around Here

    Joined:
    Apr 12, 2017
    Messages:
    3
    When I create the client profile in the router, I specify my username and password along with uploading my .ovpn file. Once uploaded, I notice that the vpn_client5_username and vpn_client5_password variables are empty in nvram. Should that be the case? They are populated when I activate the profile from the GUI, but not when I start from the command line. When I edit the client profile in the router, the username and password are persisted in the gui.

    I tried to set these variables manually before starting via command line and that gets me a bit further in the logs, but I ultimately get the following. I'm guessing that there is also some other information pertinent to authentication that may be missing.

    Regarding my OpenVPN configuration, I have the auth-user-pass directive set in my .ovpn.

    Code:
    Apr 12 14:17:21 openvpn[4636]: AUTH: Received control message: AUTH_FAILED
    
     
    Last edited: Apr 12, 2017
  12. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    28,553
    Location:
    Canada
    Maybe Asus's implementation works differently from mine them. While Asus originally reused my code, they did a few changes to it as they added it to the original firmware, so our implementations are slightly different now.
     
  13. lifeowl

    lifeowl New Around Here

    Joined:
    Apr 12, 2017
    Messages:
    3
    Thanks RMerlin, perhaps I'll flash yours back and try again. I originally had your firmware loaded (I love the selective routing), but I was having some issues with the OpenVPN client profile info (like OpenVPN IP Address) persisting despite deleting and loading new profiles (with different OpenVPN IP addresses). I'll post a new thread if I see the same behavior.

    Thanks again!
     
  14. 5iver

    5iver New Around Here

    Joined:
    Mar 8, 2018
    Messages:
    1
    Firmware 380.69_2 on RT-AC68. Functionally, this has been working for me when used through ssh, but the UI of the VPN Server tab gets out of sync. Turning on the VPN, the UI updates to correctly reflect the new state. But when turning the VPN off, the VPN Server tab will still display it as ON. There is also a message...
    Code:
    "Initialinzing the settings of OpenVPN server now, please wait a few minutes to let the server to setup completed before VPN clients establish the connection"
    
    ... but this does now go away and persists after logout/login. Oddly, the VPN Status tab always shows the correct status.