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!

We're celebrating BIG today with the release of v1.0! The beers are on the house, and we're giving away free Amazon gift cards! Yeah, ok, maybe not... but still, I'm really happy how far this script has come. Yes, it does seem to favor my VPN provider (NordVPN) pretty heavily, but that's simply because NordVPN makes things extremely easy and flexible to work with using their API. Being a previous ExpressVPN user, I'm really happy to have made this switch many months ago. I'm probably going to let things settle a bit here on v1.0, but if anyone has any other great ideas to tack onto this VPN Monitor script, I'm all ears. ;)

v1.0 - (Feb 26, 2022)
* We're at the big v1.0! VPNMON-R2 (and VPNON) have made some huge strides in these 2 short months! ;)
* Introducting a new NordVPN Server Load stat! In lieu of showing whether or not Skynet is getting updated on the stats row, it now shows the NordVPN Server Load thanks to a suggestion by @Jack Yaz. This Load stat is only available if you enable the "UseNordVPN" variable and set it to "1", or if the "NordVPNSuperRandom" variable is set to "1". Otherwise, it will default to showing the Skynet stat based on if "UpdateSkynet" is set to "1".
* A great byproduct to now showing this Load stat, is that another VPN reset can occur if it exceeds a certain threshhold. Currently the "NordVPNLoadReset" is set to 50, so if the current NordVPN server you're connected to exceeds a 50% load, it will reset the VPN to look for another server with a lesser load. All these items are totally configurable at the top of the script.

Huge thanks to @Jack Yaz and @SomeWhereOverTheRainBow for all your encouragement & support!
 
How does this work with VPN Director, particularly if you randomize the connections?
 
How does this work with VPN Director, particularly if you randomize the connections?
It doesn't really touch VPN Director. As long as you have configured your VPN slots and the VPN Director rules, then you're good to go. Depending on how you want to use VPNMON-R2, you can either let it monitor your connections, and:
  1. Randomly choose to connect to a new VPN slot in conjunction with VPNMGR (if you use NordVPN, WeVPN, or PIA). VPNMGR is called to find and select new VPN servers based on distance, load, city, etc., or how you have configured VPNMGR to operate, and populates your (up to 5) VPN slots with these new IP addresses. VPNMON-R2 then randomly picks one of these 5 to connect to.
  2. Randomly choose a new VPN slot that is populated by 1920+ possible US-based VPN servers (if you strictly use NordVPN). In this case, VPNMON-R2 will actually randomly populate your (up to 5) VPN slots with random NordVPN servers, then randomly pick one of the 5 to connect to. That's why it's called SuperRandom(tm) ;)
  3. Or, randomly choose one of your (up to 5) VPN slots if you use any other kind of VPN. In this case, it doesn't touch or require VPNMGR, or deals with any of the API's necessary to pull NordVPN server data to populate your (up to 5) VPN slots. It'll just randomly pick one of your 5 preconfigured VPN slots.
Hope this helps!
 
Last edited:
It doesn't really touch VPN Director. As long as you have configured your VPN slots and the VPN Director rules, then you're good to go. Depending on how you want to use VPNMON-R2, you can either let it monitor your connections, and:
  1. Randomly choose to connect to a new VPN slot in conjunction with VPNMGR (if you use NordVPN, WeVPN, or PIA). VPNMGR is called to find and select new VPN servers based on distance, load, city, etc., or how you have configured VPNMGR to operate, and populates your (up to 5) VPN slots with these new IP addresses. VPNMON-R2 then randomly picks one of these 5 to connect to.
  2. Randomly choose a new VPN slot that is populated by 1920+ possible US-based VPN servers (if you strictly use NordVPN). In this case, VPNMON-R2 will actually randomly populate your (up to 5) VPN slots with random NordVPN servers, then randomly pick one of the 5 to connect to. That's why it's called SuperRandom(tm) ;)
  3. Or, randomly choose one of your (up to 5) VPN slots if you use any other kind of VPN. In this case, it doesn't touch or require VPNMGR, or deals with any of the API's necessary to pull NordVPN server data to populate your (up to 5) VPN slots. It'll just randomly pick one of your 5 preconfigured VPN slots.
Hope this helps!
Not really. VPN Director tells specific IP addrs from my local network to use VPN1. That will not change if I randomize the VPN connections, which BTW, I'd like to do. Unless your randomizing functionality changes the server for VPN1, or you change the settings of Director, then I'm not sure that function will work with Director.
 
Not really. VPN Director tells specific IP addrs from my local network to use VPN1. That will not change if I randomize the VPN connections, which BTW, I'd like to do. Unless your randomizing functionality changes the server for VPN1, or you change the settings of Director, then I'm not sure that function will work with Director.
Let's face it... VPN Director is pretty simplistic. It stops/starts VPN services, and gives you a way to build rules for your individual VPN slots.

VPNMON-R2 simply changes the IP address on your VPN clients 1-5 page(s), leaving practically everything else alone. So, if your VPN1 was originally pointing to 33.283.83.22 in Atlanta, it will change it to 93.31.54.11 in Seattle (for example). All your VPN Director rules stay in place, and will route the same way out through VPN1, even though it changed to a different exit node server.

Or on the other hand, if you don't want it to change your exit node IP addresses and just turn on random VPN clients 1-5, just turn off all the options... ie. Set UpdateVPNMGR=0, UseNordVPN=0, UpdateSkynet=0.

Does that help explain it a bit better? Or give it a try if you want to see it in action. ;)

Here's an example of my VPN Director settings...
Screenshot 2022-03-04 19.12.52.png
 
Last edited:
VPNMON-R2 simply changes the IP address on your VPN clients 1-5 page(s), leaving practically everything else alone. So, if your VPN1 was originally pointing to 33.283.83.22 in Atlanta, it will change it to 93.31.54.11 in Seattle (for example). All your VPN Director rules stay in place, and will route the same way out through VPN1, even though it changed to a different exit node server.
This is exactly what I was looking to get answered. Thanks, I'll try it to see how it works.
 
This is exactly what I was looking to get answered. Thanks, I'll try it to see how it works.
OK, that did not go well. First, I do not have NordVPN, I have PIA. So it keep trying to get stats as if I was connected to Nord. Other messages also said NordVPN, so kind of disconcerting for a PIA user. See attached screen shoot.
Second, it disabled all the connected VPN clients, but but did not do anything to change VPN1. For me, VPN1 still points to Chicago. It disabled all VPN clients except for VPN5, which for me is Seattle. But Director uses VPN1, so with it disabled, all those addresses are now going out the WAN. Definitely not what I wanted.
Also there was no opportunity to change any options, so it went to Skynet even though, per your message, I did not want it to do that.
I manually reenabled all the VPN clients, particularly VPN1 which is what I use, so now I think I'm back to where I started, hopefully.
 

Attachments

  • VPNMon NordVPN Bug.PNG
    VPNMon NordVPN Bug.PNG
    14.4 KB · Views: 83
I decided to look at the source of your script. I thought the script was going to ask me what options I wanted. I see now that I have to edit the script file to get to set the options that I want, like disable Nord, set the ping address, and set the rotate time. I should have looked at that before commenting.

In reviewing your script, it does not appear to do anything with VPN Director that I can tell. It will disable all VPN clients and enable a random client, which is fine, but that assumes all IPs will use that one enabled client. Any IP assignments in Director that point to VPN1 will stay pointed at VPN1. So if VPN1 is disabled, then those IPs will revert to using the WAN and not the randomly-enabled VPN client, which is definitely not what I want to do. Or, am I missing something?
 
I decided to look at the source of your script. I thought the script was going to ask me what options I wanted. I see now that I have to edit the script file to get to set the options that I want, like disable Nord, set the ping address, and set the rotate time. I should have looked at that before commenting.

In reviewing your script, it does not appear to do anything with VPN Director that I can tell. It will disable all VPN clients and enable a random client, which is fine, but that assumes all IPs will use that one enabled client. Any IP assignments in Director that point to VPN1 will stay pointed at VPN1. So if VPN1 is disabled, then those IPs will revert to using the WAN and not the randomly-enabled VPN client, which is definitely not what I want to do. Or, am I missing something?
@TonyK132... there is no menu, if that's what you're asking. You would need to configure the settings at the top of the script before running it.

I'm going to assume all your settings in VPN Director are correct. If you manually disable VPN1 and enable VPN5, and your IPs get redirected over the WAN, then you need to configure your VPN Director to handle that situation as well. See my example above. I'm pointing my Google Nest Wifi through each of my VPN1-5 clients, so when one gets disabled, and another enabled, the Google Nest Wifi continues to connect through VPN.

Even if you only have 1 VPN slot, and you're not using anything but PIA, this script would be able to keep an eye on that one connection, and reset it if it lost connection, etc.

In your case, running PIA (and I'm assuming not VPNMGR?), then you would want to configure these settings so that it doesn't automatically update VPNMGR and Skynet:

Code:
UpdateVPNMGR=0                          # This variable checks to see whether you want to integrate more deeply with
                                        # VPNMGR, and should only do so if you're running NordVPN, PIA or WeVPN. Enabling
                                        # this calls VPNMGR-specific scripts to update your VPN Client configs. Disabling
                                        # this function would make VPNMON-R2 compatible with any other VPN setup.
                                        # Default = 1, change to 0 to disable, and set NordVPNSuperRandom=1.
UseNordVPN=0                            # This variable assigns NordVPN as your default VPN provider.  Setting this to 0
                                        # assumes you are using PIA, WeVPN or another VPN provider, 1 = NordVPN
NordVPNSuperRandom=0                    # This option will bypass VPNMGR, and randomly pick one of the hundreds/thousands
                                        # of NordVPN servers located within the default country, and will populate a VPN
                                        # Server IP + Description into your VPN Client slots 1 through N.
                                        # *** Please note #1: Please change UpdateVPNMGR=0 if you enable this function.
                                        # *** Please note #2: This assumes your VPN Client Slots are configured correctly.
UpdateSkynet=0                          # This variable checks to see whether or not to update Skynet Firewall whitelist
                                        # with NordVPN IPs for default country.  Default = 1, change to 0 to disable.

I appreciate your feedback... I'll add another section to the readme/OP that helps explain what needs to be done to configure it correctly based on your particular situation.
 
Thanks. Have you tried to do make this system work based on doing cron jobs vs keeping a window open? Doing a 1 min cron timer to check for the VPN being up might tax the system too much but doing a daily VPN rotate would certainly be possible.
 
Thanks. Have you tried to do make this system work based on doing cron jobs vs keeping a window open? Doing a 1 min cron timer to check for the VPN being up might tax the system too much but doing a daily VPN rotate would certainly be possible.
@TonyK132, actually what you're referring to is VPNON v0.8, also available for download. It's a standalone version of the function that resets and randomizes your VPN connection, meant to be run as a cron job. It doesn't do any monitoring, just strictly reset and reconnect at a certain time. It's available here: https://www.snbforums.com/threads/r...set-and-randomize-your-vpn-connections.76742/
 
Last edited:
Coming soon to an SSH terminal near you... VPNMON-R2 v1.1... Teaser screenshot below. Now includes a fully integrated configuration utility (@TonyK132)! No more having to manually edit the script itself... Script is now also called via commandline arguments in order to configure the script, or monitor your VPN connections during normal operating conditions. ;)

vpnmonr211-config.PNG
 
Last edited:
Coming soon to an SSH terminal near you... VPNMON-R2 v1.1... Teaser screenshot below. Now includes a fully integrated configuration utility (@TonyK132)! No more having to manually edit the script itself... Script is now also called via commandline arguments in order to configure the script, or monitor your VPN connections during normal operating conditions. ;)

View attachment 40193
Exciting! I'd suggest storing config in your own folder in /jffs/addons though, instead of /jffs/scripts as per addon development guidelines :)
 
Exciting! I'd suggest storing config in your own folder in /jffs/addons though, instead of /jffs/scripts as per addon development guidelines :)

Thanks Jack... I guess it's time to start uncluttering the scripts folder. ;)
 
I'm pleased to announce v1.1 available as of today!

v1.1 - (Mar 15, 2022)
* Added an integrated configuration utility that steps you through all available configurable options to give you the most compatible experience for your setup. This tools makes the experience much more pleasing than having to deal with manually editing (and understanding) the options that were available at the top of the script. The configuration tool is called by using the following command: "sh vpnmon-r2.sh -config"
* Introduced the capability to use commandline arguments to perform various functions in the script. Available commands are (1) -h or -help -- to display a quick overview of available commands, (2) -log -- to display the contents of the log file within the NANO text editor, (3) -config -- this runs the configuration utility, and steps you through all available options, and writes your selections to a config file, and (4) -monitor -- this runs VPNMON-R2 under normal monitoring operating conditions to keep an eye on the health of your VPN connection.
* Moved all working files (config, log and reset log) to its own dedicated folder named "vpnmon-r2.d" under "/jffs/addons". The main script can still be found under "/jffs/scripts/vpnmon-r2.sh"
* Various optimizations and small bug fixes (more like annoyances that bother my OCD).
 
When you're on a roll... so here's v1.2! :)

v1.2 - (Mar 17, 2022)
* Added for the capability of VPNMON-R2 to check for a new version on a periodic basis, and will alert you within the interface when a new version becomes available for download. From v1.2 moving forward, the script will provide for the capability to check and alert you for new updates.
* Added a new commandline argument to the list of available commands: "sh vpnmon-r2.sh -update" -- this runs the script update utility which downloads and installs the latest version from the github repository.
* Minor optimizations and enhancements

Here's what you can expect to see when a new update becomes available on the bottom of the UI:
vpnmon-r212-updateavail.PNG


And here's the interface that allows you to download an install new updates using the "sh vpnmon-r2.sh -update" commandline switch:
vpnmon-r212-updateutil.PNG


Enjoy! :)
 
Lucky number v1.3!

v1.3 - (Mar 20, 2022)
* Added another row of stats! The latest additions include near-realtime average RX and TX bandwitdh (in Mbps) across the active VPN tunnel. Also, the current total TX and RX bytes for the VPN tunnel is displayed and gradually increments from when the tunnel was initialized (in Gb). Stats for these bandwith figures are interpreted from an OpenVPN status file that is auto generated when the tunnel is initiated. Please understand that these numbers are generated based on the interval time period you have configured, and may not reflect actual real-world amounts. These will give you a good general indicator on what's happening across your VPN. That's my disclaimer. ;)
* The ability to enable/disable these stats is available in the configuration utility (vpnmon-r2.sh -config).
* I have really taken a liking to the new ASCII art font title for VPNMON-R2, that I have now incorporated it on the top of the main UI. Version number was moved to its right.
* I have moved the new version alert to directly below the ASCII art font title, and is more discreet in a red font in letting you know when a new version is available.

Here's a screenshot of the UI with the new title and stats row:
Screenshot 2022-03-20 20.34.34.png


Enjoy!
 
@Viktor Jaep congratulations and thanks, this seems to be coming along nicely!

Cheeky observation/wish - all we need now is for this info to be presented in another add-on tab in the GUI under the VPN category, or for you and @Jack Yaz to combine forces?

:)
 
@Viktor Jaep Very nice!

Can you change the interface so that if a supported VPN provider is in use, instead of showing "Exit: Undefined" that it shows something like "Name: ???" where ??? is the description in the VPN client defintiion? For example, I have "New York-JFK" as the name of my VPN client 1.

Also, to clarify, the progress bar at the bottom shows when the next ping is going to happen?

Is there somewhere that explains the numbers on the VPN State line? beside one of them, the active one, I have a "2".

How are the VPN Rx, Tx and Total Rx and Tx calculated? When I go to the VPN status page, the values there don't match the values shown by VPNMon.

I had VPNMon running overnight once and it successfully switched from VPN Client slot 1 to slot 2. Great. The next night I didn't have it running and it didn't run. So it always has to be running and you can use "screen". Maybe VPNMon can be split into two pieces where one is run by CRON every minute to run the check and switch VPN clients, if/when needed while the second piece displays the results of the CRON job. The display can be a one time thing or it can loop until closed so that it would look like the current VPMon. Could this also lend itself to becoming a page in the GUI...I don't know?

In any case, it's great. Just offering ideas/suggestions for you.

Thanks for this.
 
Similar threads
Thread starter Title Forum Replies Date
Ripshod (Not specifically) VPNMON-R3 1.11 failure domino effect Asuswrt-Merlin AddOns 20

Similar threads

Latest threads

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