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!

OPENVPN speeds drop dramatically after a while?

Discussion in 'Asuswrt-Merlin' started by coen99, Mar 14, 2019 at 6:02 AM.

  1. coen99

    coen99 Occasional Visitor

    Joined:
    Wednesday
    Messages:
    11
    Hello guys,

    First of all I really like this forum. I just joined but I have been reading a lot of posts already and it helped me a lot with a few things.
    However the problem I have I cannot solve.

    I have a Asus AX88 with Merlin 384.9. Thanks Merlin for the all the good work!
    I use a PC connected to the router via an ethernet cable.
    I'm using PIA for VPN and it all works fine for a while (high speeds etc). I have a A+-A-A+ connection using QOS fq-codel.
    But after a while (eg. when I go to sleep and the next morning but sometimes after a few hours) the speeds drop from 190MB to 5 MB/s. And the ping is horrible. Then when I turn the OPENVPN client OFF and directly back ON again everything works fine again.

    OpenVPN Client Settings publish.png
    [​IMG]
    Any ideas why?
    cheers
     
    Last edited: Mar 14, 2019 at 6:14 AM
  2. ASadani

    ASadani Regular Contributor

    Joined:
    Apr 27, 2017
    Messages:
    159
    Create a script to do a vpn restart as a cron job. that is what I have done however I don't know the syntax for a regular openvpn config. The provider may have implemented an encrypted QoS to break the encrypted thread. Typically this is implemented in a 24 hour range so a nightly reboot at about 6 AM should do the trick.
     
  3. Martineau

    Martineau Very Senior Member

    Joined:
    Jul 8, 2012
    Messages:
    1,981
    Location:
    UK
    Given that a simple local restart of the VPN Client 'fixes' the throughput issue, it is highly likely that the issue is on the PIA end?

    Depending on where the PIA VPN end-point is, it could simply be that the 'virtual' PIA VPN server used by your connection becomes oversubscribed/saturated, or worst case scenario - you are subject to PIA bandwidth shaping due to inactivity while you are asleep?

    Being in the UK, I connect to the USA and implemented a crude "follow-the-sun" approach to extract as much VPN Client performance as possible i.e. flip between East coast (NY) and West Coast (LA) .

    So although you can automate/implement a crude fix.... i.e. use cron to automaticially restart the VPN client just before you wake up, or use a more intelligent approach (see thread link below) and switch to another PIA configuration when the performance drops below your acceptable threshold.

    Naturally you should contact PIA to see if they have an explanation, but I suspect you would also need to do some investigation work to try and identify precisely when the throughput degradation occurs.... i.e. a sudden immediate drop from 190Mbps to 5Mbps at the same time overnight say 03:00, or gradually over an extended period overnight say between several hours say 01:00-04:00

    I see you have only recently joined, so perhaps scripting isn't something you feel like attempting, but perhaps this thread If OpenVPN provider is offline, failover to other provider? may be useful?
     
    martinr likes this.
  4. coen99

    coen99 Occasional Visitor

    Joined:
    Wednesday
    Messages:
    11
    Thnx Guys for the really quick replies!

    I send a email to PIA to see what they say.
    The "follow the sun approach" seems also a good idea but first I'll wait for PIA.
    Keep U informed.

    Cheers

    PS: Will keep track of the when and how.
     
    Last edited: Mar 14, 2019 at 8:01 AM
  5. coen99

    coen99 Occasional Visitor

    Joined:
    Wednesday
    Messages:
    11
    BTW what would be a script to just simply restart the vpn client everyday at 7.00 am?

    I'm a real noob as to scripting.
    @Martineau: I read your WinSCP. So I know how to use that ;)

    I got this far (I really feel a 2 year old talking to a University Prof)

    script: restart.sh

    #!/bin/sh
    service restart_vpnclient1
    exit
    =================

    CRONJOB

    # restart 7:15AM
    15 7 * * * /usr/local/bin/restart.sh

    =================

    That's it. I have no idea if this will work and will keep working, even after a firmware update?
    I don't know where to put the cronjob file? What will be the extension of this file? .sh? etc.

    Any help will be appreciated.

    thnx in advance
    UltraNoob

    BTW: still waiting for a reply from PIA
     
  6. Martineau

    Martineau Very Senior Member

    Joined:
    Jul 8, 2012
    Messages:
    1,981
    Location:
    UK
    I would use the following system script to automatically call your custom script say 'VPN_ClientCRONrestart.sh' once during the router boot cycle.

    /jffs/scripts/init-start
    Code:
    #! /bin/sh
    
    # Restart VPN Client
    sh /jffs/scripts/VPN_ClientCRONrestart.sh
    I personally use '.sh' files to differentiate my custom scripts from the system reserved scripts, so create your custom script as say

    /jffs/scripts/VPN_ClientCRONrestart.sh
    Code:
    #! /bin/sh
    
    # Restart VPN Client 1 @07:15 daily
    logger -st "($(basename $0))" "Schedule Restart of VPN Client 1 @07:15 daily"
    cru a VPN1_Restart "15 7 * * *" service restart_vpnclient1
    but some prefer (rather than use init-start) to use the following system script

    /jffs/scripts/services-start

    see Wiki/documentation for Asuswrt-merlin , User scripts and Scheduled tasks (CRON) to understand the reserved scripts and usage etc.
     
    Last edited: Mar 14, 2019 at 12:17 PM
  7. coen99

    coen99 Occasional Visitor

    Joined:
    Wednesday
    Messages:
    11
    Wow, thnx!
    Will give it try.
     
  8. coen99

    coen99 Occasional Visitor

    Joined:
    Wednesday
    Messages:
    11
    Hello everyone,

    I have been testing a lot, tried all kind of scenario's, even put on the Asus original firmware.
    Finally I found the cause. It's the famous T o r r ent sharing software. This connects through the Sockes5 proxy port 1080.
    If it runs and you turn off the VPNclient and turn it on again everything is fine and stays fine. This way I dismissed the software at first.
    So if it's already running it does not have any impact. It's turning on this software that somehow has this effect (strange ?).

    Anyway, I found the culprit causing this trouble ;) and wanted to share so maybe other people can benefit from it.
    Or maybe you guys have an explanation?

    Thank you all for your help and suggestions.
    Cheers

    BTW: I love this router, as the speeds of OPENVPN are great. The hardware acceleration of AES has certainly something to do with this. Nice to see that even at high transfer speeds and many clients the CPU is not breaking a sweat! Seems to be futureproof.
    With my previous Asus AC66 I was happy to reach about 12Mb/s through OPENVPN, as now I reach the almost the max of my connection around 190Mb/s. Also the responsiveness to other clients stays. As with the AC66 the CPU was at 100% and nothing much else was possible.
     
    Last edited: Mar 15, 2019 at 12:41 PM