What's new

VPNMON VPNMON-R2 v2.0 -Jul 10, 2022- Monitor your VPN connection's Health (Thread locked/closed)

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

Hey @JAX1337 ... I've uploaded a beta to test out... Please install, and step through the -config, as it will ask for you to specify the number of ms you want the ping across the tunnel to be before it tries to reconnect... (default = 100ms)

Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-1.9b1.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"

What's new since v1.8?
* ADDED: A fourth qualifier variable thanks to @JAX1337 that will reset the VPN connection if the average ping across the tunnel is greater than the specified amount, in the hopes of eliminating a slow connection in favor of something a little faster. Please make sure you run through the config to change the default of 100ms to something you prefer.
* CHANGED: Enhanced and simplified some of the setup process when it comes to asking questions about NordVPN, SurfShark and PerfectPrivacy, and assigning variables to each.
 
I've uploaded a beta to test out
Have thrown in the beta in to give it a crack, left it on 100ms default for now, will be interested to see if it triggers over a few days I guess?
 
I would have to make a wild guess that if the load increases, so does the ping. So what if you tried this... pick your local Nord servers that would normally provide you with the best speeds, and populate those in your 5 VPN slots. Then, decrease your load parameter from 50, to say... 25? If your SG server exceeds that load, then it will continue to randomly pick a server with a lower ping/load below 25. Thoughts?

Please know... I'm just guessing that a higher load would yield a higher ping... I'll have to see if this correlates. But this might be workable?

EDIT: In the end, this is a great idea, @JAX1337 ... I could use the ping value going across the tunnel as another parameter I could measure against in order to force a reset in search of something that's lower than the set criteria.

unless under heavy load ping wont be affected normally , but one thing i have noticed going by my past experiences , if the ping is low , i will have a better experience than the one with higher ping .

Thanks alot for considering my request . This is a wonderful script .Great work once again

Testing the beta, will let you know how it goes .
 
Last edited:
unless under heavy load ping wont be affected normally , but one thing i have noticed going by my past experiences , if the ping is low , i will have a better experience than the one with higher ping .

Thanks alot for considering my request . This is a wonderful script .Great work once again

Testing the beta, will let you know how it goes .
Yeah, depending on your situation, you may want to tweak that ping ms up or down... would love to know what you end up with! I'm usually pretty lucky... and seem to land on sub-100ms connections across the US, but there are times when it has spiked above that probably just due to congestion on the interwebs, especially if it's going from one side of the country to the other. I'll be keeping my eye on it as well. Thanks to the both of you, @JAX1337 and @Stephen Harrington for trying it out! :)
 
Yeah, depending on your situation, you may want to tweak that ping ms up or down... would love to know what you end up with! I'm usually pretty lucky... and seem to land on sub-100ms connections across the US, but there are times when it has spiked above that probably just due to congestion on the interwebs, especially if it's going from one side of the country to the other. I'll be keeping my eye on it as well. Thanks to the both of you, @JAX1337 and @Stephen Harrington for trying it out! :)


I have the ping threshold to 100ms aswell , with all the SNG servers i get around 60-70 ms .

i just checked the logs

Code:
Mon Jun 27 21:40:05 IST 2022 - VPNMON-R2 ----------> ERROR: NordVPN.txt list is blank!
Mon Jun 27 21:40:25 IST 2022 - VPNMON-R2 - Refreshed VPNMGR Server Locations and Hostnames
Mon Jun 27 21:40:26 IST 2022 - VPNMON-R2 - Randomly selected VPN3 Client ON
Mon Jun 27 21:40:26 IST 2022 - VPNMON-R2 - VPN Reset Finished
Mon Jun 27 21:40:26 IST 2022 - VPNMON-R2 - Resuming normal operations
Mon Jun 27 21:41:31 IST 2022 - VPNMON-R2 - API call made to update VPN city to Seoul
Mon Jun 27 22:05:22 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Mon Jun 27 22:05:24 IST 2022 - VPNMON-R2 - API call made to update VPN city to Seoul
Mon Jun 27 22:31:47 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Mon Jun 27 22:31:48 IST 2022 - VPNMON-R2 - API call made to update VPN city to Singapore
Mon Jun 27 22:39:54 IST 2022 - VPNMON-R2 ----------> ERROR: Connection failed - Executing VPN Reset
Mon Jun 27 22:39:54 IST 2022 - VPNMON-R2 - Executing VPN Reset
Mon Jun 27 22:39:58 IST 2022 - VPNMON-R2 - Killed all VPN Client Connections
Mon Jun 27 22:40:13 IST 2022 - VPNMON-R2 ----------> ERROR: NordVPN.txt list is blank!
Mon Jun 27 22:40:33 IST 2022 - VPNMON-R2 - Refreshed VPNMGR Server Locations and Hostnames
Mon Jun 27 22:40:33 IST 2022 - VPNMON-R2 - Randomly selected VPN3 Client ON
Mon Jun 27 22:40:33 IST 2022 - VPNMON-R2 - VPN Reset Finished
Mon Jun 27 22:40:34 IST 2022 - VPNMON-R2 - Resuming normal operations
Mon Jun 27 22:41:36 IST 2022 - VPNMON-R2 - API call made to update VPN city to Singapore
Tue Jun 28 09:23:23 IST 2022 - VPNMON-R2 - Successfully wrote a new config file
Tue Jun 28 09:23:35 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Tue Jun 28 09:23:36 IST 2022 - VPNMON-R2 - API call made to update VPN city to Singapore
Tue Jun 28 19:03:23 IST 2022 - VPNMON-R2 ----------> WARNING: NordVPN Server Load is higher than 50% - Executing VPN Reset
Tue Jun 28 19:03:23 IST 2022 - VPNMON-R2 - Executing VPN Reset
Tue Jun 28 19:03:28 IST 2022 - VPNMON-R2 - Killed all VPN Client Connections
Tue Jun 28 19:03:42 IST 2022 - VPNMON-R2 ----------> ERROR: NordVPN.txt list is blank!
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - Refreshed VPNMGR Server Locations and Hostnames
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - Randomly selected VPN5 Client ON
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - VPN Reset Finished
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - Resuming normal operations
Tue Jun 28 19:05:05 IST 2022 - VPNMON-R2 - API call made to update VPN city to Amsterdam
Tue Jun 28 19:12:06 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Tue Jun 28 19:12:07 IST 2022 - VPNMON-R2 - API call made to update VPN city to Amsterdam

Have you added logs entries for the ping check , if yes i don't see selection based on ping .
as of now I'm running on higher ping and nothing on the logs about looking for a better server.

1656424478045.png



what i was hoping for was instead of randomly selecting another server , if it could check the pings of the other servers and select which ever one had the least ping with lesser load than 50%

Am i doing something wrong ?


i have 3 sng servers added and 1 Thailand and 1 NL

1656424675988.png



so ideally it should have started one of the other SNG severs or Thailand one as TH has better pings than NL
 
I have the ping threshold to 100ms aswell , with all the SNG servers i get around 60-70 ms .

i just checked the logs

Code:
Mon Jun 27 21:40:05 IST 2022 - VPNMON-R2 ----------> ERROR: NordVPN.txt list is blank!
Mon Jun 27 21:40:25 IST 2022 - VPNMON-R2 - Refreshed VPNMGR Server Locations and Hostnames
Mon Jun 27 21:40:26 IST 2022 - VPNMON-R2 - Randomly selected VPN3 Client ON
Mon Jun 27 21:40:26 IST 2022 - VPNMON-R2 - VPN Reset Finished
Mon Jun 27 21:40:26 IST 2022 - VPNMON-R2 - Resuming normal operations
Mon Jun 27 21:41:31 IST 2022 - VPNMON-R2 - API call made to update VPN city to Seoul
Mon Jun 27 22:05:22 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Mon Jun 27 22:05:24 IST 2022 - VPNMON-R2 - API call made to update VPN city to Seoul
Mon Jun 27 22:31:47 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Mon Jun 27 22:31:48 IST 2022 - VPNMON-R2 - API call made to update VPN city to Singapore
Mon Jun 27 22:39:54 IST 2022 - VPNMON-R2 ----------> ERROR: Connection failed - Executing VPN Reset
Mon Jun 27 22:39:54 IST 2022 - VPNMON-R2 - Executing VPN Reset
Mon Jun 27 22:39:58 IST 2022 - VPNMON-R2 - Killed all VPN Client Connections
Mon Jun 27 22:40:13 IST 2022 - VPNMON-R2 ----------> ERROR: NordVPN.txt list is blank!
Mon Jun 27 22:40:33 IST 2022 - VPNMON-R2 - Refreshed VPNMGR Server Locations and Hostnames
Mon Jun 27 22:40:33 IST 2022 - VPNMON-R2 - Randomly selected VPN3 Client ON
Mon Jun 27 22:40:33 IST 2022 - VPNMON-R2 - VPN Reset Finished
Mon Jun 27 22:40:34 IST 2022 - VPNMON-R2 - Resuming normal operations
Mon Jun 27 22:41:36 IST 2022 - VPNMON-R2 - API call made to update VPN city to Singapore
Tue Jun 28 09:23:23 IST 2022 - VPNMON-R2 - Successfully wrote a new config file
Tue Jun 28 09:23:35 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Tue Jun 28 09:23:36 IST 2022 - VPNMON-R2 - API call made to update VPN city to Singapore
Tue Jun 28 19:03:23 IST 2022 - VPNMON-R2 ----------> WARNING: NordVPN Server Load is higher than 50% - Executing VPN Reset
Tue Jun 28 19:03:23 IST 2022 - VPNMON-R2 - Executing VPN Reset
Tue Jun 28 19:03:28 IST 2022 - VPNMON-R2 - Killed all VPN Client Connections
Tue Jun 28 19:03:42 IST 2022 - VPNMON-R2 ----------> ERROR: NordVPN.txt list is blank!
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - Refreshed VPNMGR Server Locations and Hostnames
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - Randomly selected VPN5 Client ON
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - VPN Reset Finished
Tue Jun 28 19:04:02 IST 2022 - VPNMON-R2 - Resuming normal operations
Tue Jun 28 19:05:05 IST 2022 - VPNMON-R2 - API call made to update VPN city to Amsterdam
Tue Jun 28 19:12:06 IST 2022 - VPNMON-R2 - API call made to update WAN city to Mumbai
Tue Jun 28 19:12:07 IST 2022 - VPNMON-R2 - API call made to update VPN city to Amsterdam

Have you added logs entries for the ping check , if yes i don't see selection based on ping .
as of now I'm running on higher ping and nothing on the logs about looking for a better server.

View attachment 42246


what i was hoping for was instead of randomly selecting another server , if it could check the pings of the other servers and select which ever one had the least ping with lesser load than 50%

Am i doing something wrong ?
Nice catch... yes, I did add log entries for high ping ms values... let me see if I can troubleshoot this further... I'll send out another beta shortly!

EDIT... actually, it looks like you're still on v1.8. Try downloading the 1.9b1 script?
 
Nice catch... yes, I did add log entries for high ping ms values... let me see if I can troubleshoot this further... I'll send out another beta shortly!

EDIT... actually, it looks like you're still on v1.8. Try downloading the 1.9b1 script?
ohh that's very strange i did run the 1.9b command i did config the ping value
let me try again
 
1656425316030.png


and it switched to SNG , looks like the script works fine , will give it some more time before concluding @Viktor Jaep
 
Excellent work. Thanks again!

I have a suggestion for the next update that could make the update process faster for people. What if you looked for an existing config file and read the contents to use those as the default if the values exist? If they don't, then the defaults you hardcoded are provided. None of this would change the behavior of the script permitting the user to change the defaults.

For example:
  • New user, no config file: Nothing changes. The -config command provides the defaults you currently use.
  • Existing user with a config file, but you have new variables: Read the config files, for those variables that already exist, use that as the default instead of your defaults.
    • If a user previously set 9.9.9.9 to test connectivity, then you would display that as the default instead of 8.8.8.8.
    • If the variable is new to this release, then you use the default you hardcoded.
  • Existing user with config file and no new variables: They can just hit Enter almost the entire way through to keep their original settings.

Alrighty @iTyPsIDg ... and a beta for you! I've implemented your request above to the best of my ability. When you start the -config, it will ask you if you want to start from (1) default values, or (2) custom values based on an existing config file. From there, you can pretty much hit enter all the way down to keep all your custom values. Please let me know if I missed anything, OK? Would love to hear your thoughts!

Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-1.9b2.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"

What's new since v1.9b1?
* Totally revamped the -config process to either let you start from scratch with default values, or use already existing values that you have modified in your current config file. Great suggestion by @iTyPsIDg to prevent you from having to continually modify the same entries over and over when a new version comes out. ;)
 
From there, you can pretty much hit enter all the way down to keep all your custom values. Please let me know if I missed anything, OK?

Installed beta2, and did the "-config" choosing to use existing values, seemed to go pretty well for my simple setup ... thanks @Viktor Jaep.
 
@Viktor Jaep Yup , all going good for me aswell , updated to 1.9b2
another thought don't know if its possible :

As of now the logic seem to be testing load and ping of individual servers randomly / one after another , would it be possible, in case of a reset, to start all vpn servers together, except the current one, simultaneously and check for these conditions simultaneously. Doing so would considerably reduce the down time in case of multiple switches.

Don't know how feasible it is , just a thought

Rest all working flawlessly.
 
Last edited:
Ran the beta , however cron job entry seems missing ?
noticed it once i rebooted the router

View attachment 42311
Hey @JAX1337 ... cron jobs typically don't survive a reboot unless you add the cron job command to your services-start file? Is this what you are referencing to?
 
@Viktor Jaep Yup , all going good for me aswell , updated to 1.9b2
another thought don't know if its possible :

As of now the logic seem to be testing load and ping of individual servers randomly / one after another , would it be possible, in case of a reset, to start all vpn servers together, except the current one, simultaneously and check for these conditions simultaneously. Doing so would considerably reduce the down time in case of multiple switches.

Don't know how feasible it is , just a thought

Rest all working flawlessly.
One of the main functions of vpnmon-r2 is to remove the chances that more than 1 VPN starts at a time due to the fact that it can create conflicts and routing issues. So lighting all slots up at the same time would be a big no-no. I'll think about your request to see if there's a different way of doing this, to sample each of your vpn servers in each of your slots, check their load/ping, and make a connection to the one with the lowest. There could be situations where this could also be disavantageous, as connections with similar loads/pings might compete with each other, and your connections would just be flip-flopping back and forth.
 
Hey @JAX1337 ... cron jobs typically don't survive a reboot unless you add the cron job command to your services-start file? Is this what you are referencing to?
what i was referring to, was, after reboot the script doesn't seem to work , unless i run the monitor command , i thought this was happening because of the missing cron entry

1656605719979.png




this screen shot is 5 mins after reboot as you see 2 servers running , once i run the monitor command it works and stops them .


1656605953120.png



from the logs i can see that the script is not running
 
One of the main functions of vpnmon-r2 is to remove the chances that more than 1 VPN starts at a time due to the fact that it can create conflicts and routing issues. So lighting all slots up at the same time would be a big no-no. I'll think about your request to see if there's a different way of doing this, to sample each of your vpn servers in each of your slots, check their load/ping, and make a connection to the one with the lowest. There could be situations where this could also be disavantageous, as connections with similar loads/pings might compete with each other, and your connections would just be flip-flopping back and forth.
Got it , if there is any other way it would be highly useful
 
what i was referring to, was, after reboot the script doesn't seem to work , unless i run the monitor command , i thought this was happening because of the missing cron entry

View attachment 42312



this screen shot is 5 mins after reboot as you see 2 servers running , once i run the monitor command it works and stops them .
I'm not doing anything to allow the script to autorun after a reboot... I leave that flexibility in your hands if you want or don't want to do that. I don't know where you're running things from... an SSH client? Screen? Tmux? I don't want to interfere. But yeah, personally, I just have added something like "sh /jffs/scripts/vpnmon-r2.sh -screen" to my services-start file...
 
I'm not doing anything to allow the script to autorun after a reboot... I leave that flexibility in your hands if you want or don't want to do that. I don't know where you're running things from... an SSH client? Screen? Tmux? I don't want to interfere. But yeah, personally, I just have added something like "sh /jffs/scripts/vpnmon-r2.sh -screen" to my services-start file...
Ohh , i thought it had autorun enabled my bad
 
@Viktor Jaep

Need one more help ,sorry to bother

even after adding it to services-start, the command is not running

i created it using Winscp

1656609433483.png


what am i doing wrong ?

file is 0755
 

Attachments

  • 1656609280105.png
    1656609280105.png
    15.8 KB · Views: 51

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top