What's new

VPNMON VPNMON-R2 v2.52 -Mar 27, 2023- 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!

Yes, it's actually my intention to build that functionality in as well, and will start working on this option next. Thanks! In the interim, you could configure a few of your VPN slots with recommended servers and turn off the superrandom functionality, so that it will just pick from these preconfigured ones?
Yes, I could do that, thanks for the tip!
 
Yes, I could do that, thanks for the tip!
Hi @monakh ... in case you're interested, I've got a beta release ready to try out that makes use of the NordVPN Recommended Servers function... Make sure you go into the config menu, item #6. Once selected, it will fill your 1-5 VPN slots (or however many you have specified) with the closest/fastest recommended servers when it goes through a reset... This is the same function the NordVPN app uses to pick a recommended server when you hit the "quick connect" button.

Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-2.24b1.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"
 
Yayyyy!!!! Wow, that's great! I will definitely try it out.

One thing though, the server has to be in the US (at least for me). The app, however, hits whatever is closest in the region (IIRC). Is there a way to force this?

I still have the WAN issue occurring once every couple of days (WAN state is still 2), can't find a way around it yet (except for manual intervention) but I will keep you posted.
 
Yayyyy!!!! Wow, that's great! I will definitely try it out.

One thing though, the server has to be in the US (at least for me). The app, however, hits whatever is closest in the region (IIRC). Is there a way to force this?

I still have the WAN issue occurring once every couple of days (WAN state is still 2), can't find a way around it yet (except for manual intervention) but I will keep you posted.
I'll see if there's a way... ;)

I'm still no closer to your WAN issue, since it doesn't seem to be happening on other devices. It must be AXE16000-specific. I wish I had one to test with in order to figure out some exceptions that can be made.
 
I'll see if there's a way... ;)

I'm still no closer to your WAN issue, since it doesn't seem to be happening on other devices. It must be AXE16000-specific. I wish I had one to test with in order to figure out some exceptions that can be made.
you can opt to choose a city (vpnmgr does this)
 
Yayyyy!!!! Wow, that's great! I will definitely try it out.

One thing though, the server has to be in the US (at least for me). The app, however, hits whatever is closest in the region (IIRC). Is there a way to force this?

I still have the WAN issue occurring once every couple of days (WAN state is still 2), can't find a way around it yet (except for manual intervention) but I will keep you posted.
Please give this one a shot, @monakh ... it uses your default country to grab recommended servers from... ;)

Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-2.24b2.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"
 
you can opt to choose a city (vpnmgr does this)
LOL One baby step at a time... it's grabbing recommended servers from the default country. I'll dive into selecting by city in the near future... Would seem fairly easy! ;)
 
Last edited:
Please give this one a shot, @monakh ... it uses your default country to grab recommended servers from... ;)

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

I did update the script to 2.24b2 and you are absolutely right, it populated only the servers from the US which is thoroughly awesome. Honestly, I am a happy camper :) (aside from the WAN issue, which, I am sure you are right, is unique to the AXE16000). I have a feeling it has to do with the two WAN ports on the router.
 
Last edited:
I did update the script to 2.24b2 and you are absolutely right, it populated only the servers from the US which is thoroughly awesome. Honestly, I am a happy camper :) (aside from the WAN issue, which, I am sure you are right, is unique to the AXE16000). I have a feeling it has to do with the two WAN ports on the router.
I'm not going to give up on the WAN issue, @monakh ;) You're not using both WAN ports, are you? Most other routers have 2 ports as well. I will see if I can enhance that test script a bit to get some better troubleshooting visibility into this behavior on your router, cool?
 
No, no, I wish I were that lucky in the Middle East :D One port only.

Most other routers may have two interfaces (for example, the USB port could be used as WAN1) but I am not aware of any router in the Asus range that has two physical RJ45 ports for WAN. Correct me if I am wrong. So I guess, at least with the AXE16000, you have two options for WAN1 (USB and Ethernet).

Always willing to test and troubleshoot, brother, bring it on :)
 
No, no, I wish I were that lucky in the Middle East :D One port only.

Most other routers may have two interfaces (for example, the USB port could be used as WAN1) but I am not aware of any router in the Asus range that has two physical RJ45 ports for WAN. Correct me if I am wrong. So I guess, at least with the AXE16000, you have two options for WAN1 (USB and Ethernet).

Always willing to test and troubleshoot, brother, bring it on :)
No, you are absolutely correct! I believe the vast majority of the routers have a single RJ45 WAN port, and need to use USB for the secondary. ;) The AXE16000 may be a unique animal... and I believe the AX89X may even have an SFP port built-in. Don't even believe it's Merlin-compatible.

So I've modified this test script... it shows the date/time as it's running, but now will also log events to a /jffs/scripts/wan0mon.log file if the WAN0 interface shows something other than 2 (connected). Might be interesting to match this up when it causes VPNMON-R2 to fall into this crazy loop.

Code:
#!/bin/sh

while true; do

  wan0if=$(nvram get wan0_ifname)
  wan1if=$(nvram get wan1_ifname)
  wan0=$(nvram get wan0_state_t)
  wan1=$(nvram get wan1_state_t)

  echo "$(date) - WAN0 IF:$wan0if State:$wan0 -- WAN1 IF:$wan1if State:$wan1"

  if [ $wan0 -ne 2 ]; then
    echo "$(date) - WAN0 is no longer connected - WAN0 IF: $wan0if - State: $wan0" > /jffs/scripts/wan0mon.log
  fi

  sleep 1

done
 
No, you are absolutely correct! I believe the vast majority of the routers have a single RJ45 WAN port, and need to use USB for the secondary. ;) The AXE16000 may be a unique animal... and I believe the AX89X may even have an SFP port built-in. Don't even believe it's Merlin-compatible.

So I've modified this test script... it shows the date/time as it's running, but now will also log events to a /jffs/scripts/wan0mon.log file if the WAN0 interface shows something other than 2 (connected). Might be interesting to match this up when it causes VPNMON-R2 to fall into this crazy loop.

Code:
#!/bin/sh

while true; do

  wan0if=$(nvram get wan0_ifname)
  wan1if=$(nvram get wan1_ifname)
  wan0=$(nvram get wan0_state_t)
  wan1=$(nvram get wan1_state_t)

  echo "$(date) - WAN0 IF:$wan0if State:$wan0 -- WAN1 IF:$wan1if State:$wan1"

  if [ $wan0 -ne 2 ]; then
    echo "$(date) - WAN0 is no longer connected - WAN0 IF: $wan0if - State: $wan0" > /jffs/scripts/wan0mon.log
  fi

  sleep 1

done
Thanks, I have run the script, let's see how it goes. Thank you for adding the time-stamp. That's helpful also.
 
K. I stand corrected. If there is no VPN connection (local IP), then the recommended server list uses proximity as the parameter to fill the VPN slots. So a reset is initiated, and only Tel Aviv servers are populated in all 5 slots (oops). So VPNMON is ignoring the country selection (could probably override this).
 
K. I stand corrected. If there is no VPN connection (local IP), then the recommended server list uses proximity as the parameter to fill the VPN slots. So a reset is initiated, and only Tel Aviv servers are populated in all 5 slots (oops). So VPNMON is ignoring the country selection (could probably override this).
OK interesting... let me see why it's failing to do this. Thanks for the report!
 
K. I stand corrected. If there is no VPN connection (local IP), then the recommended server list uses proximity as the parameter to fill the VPN slots. So a reset is initiated, and only Tel Aviv servers are populated in all 5 slots (oops). So VPNMON is ignoring the country selection (could probably override this).
I really appreciate you testing this! I've made a fix, and from what I can tell should work! I was pulling servers from Germany, Mexico and Canada as tests... so please let me know if this does the trick for you. ;)

Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-2.24b3.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"
 
I really appreciate you doing this just because you can, not sure if there is a huge market for folks with exactly my requirements! So, thank you :)

OK, the updated code works with a teensy meensy weensy caveat: The VPN tunnel has to be down or a VPN reset has to take place. If you (re)start VPNMON while the VPN is already connected to another country, it will not automatically make the change until it detects the interface to be down or a reset is forced. Not a biggie, at all, and one could argue it's by design!

p.s. Sometimes, I am seeing 'unknown operand' after the active tunnel listing. It's only there rarely though. Not sure what it is:
 

Attachments

  • 1664306663991.png
    1664306663991.png
    77.8 KB · Views: 64
Last edited:
I really appreciate you doing this just because you can, not sure if there is a huge market for folks with exactly my requirements! So, thank you :)
Hey I totally get it. I selfishly built this tool to suit my own needs, and decided to share it! Lol

OK, the updated code works with a teensy meensy weensy caveat: The VPN tunnel has to be down or a VPN reset has to take place. If you (re)start VPNMON while the VPN is already connected to another country, it will not automatically make the change until it detects the interface to be down or a reset is forced. Not a biggie, at all, and one could argue it's by design!
So yeah, that's correct and by design. It's purpose is to keep things stable, but if it detects trouble, it will kill all VPN instances currently running before going through the motions of reaching out to the VPN provider to grab server names and get these added to the skynet whitelist... just while you have an uninterrupted clean connection so that nothing is blocked straight across the WAN connection. Then it will initiate a new VPN connection and help maintain its stability.

p.s. Sometimes, I am seeing 'unknown operand' after the active tunnel listing. It's only there rarely though. Not sure what it is:
I see that every so often as well. It's been a tough one to catch since it's so few and far between. It's a bugger, but will continue to find ways to diagnose. Thanks for reminding me! ;)
 
Thanks to those of you who participated in the beta... v2.24 is out today! Lots of enhancements added under the hood! Enjoy!

What's new?
v2.24 - (September 30, 2022)
- ADDED:
Included new "Recommended Server" functionality for NordVPN users! As with the PC/Mobile app, when hitting the "Quick Connect" button, you are taken to the nearest, most fastest servers to your location. This functionality has now been built into VPNMON-R2, allowing you to fill your 1-N VPN slots with a selection of the closest/fastest NordVPN end points. Thanks to @monakh for the great suggestion! Make sure you go into the config menu -> option #6 -> when selecting NordVPN you will have the option to choose this functionality as long as you do not enable "SuperRandom", as it operates completely opposite from using NordVPN's recommended servers function. NOTE: Recommended servers are chosen from the country you have specified as your home country under the config options.
- CHANGED: Included JQ as part of the prerequisites needed to be installed when VPNMON-R2 is set up for the first time. This was my error, thinking that the JQ tool was either already installed by default, or came along with an Entware install by default. Now, when going into Setup -> Config, the script will check for the existence of JQ, and will prompt an install if it's not already present under /opt/bin. JQ is necessary for pulling data from the various supported VPN Providers in order to populate VPN host lists for the country you have configured. Added a check when the script starts up to ensure that all prerequisites are in place before running the script. Thanks to @monakh for noticing this behavior with JQ on a fresh install of VPNMON-R2!
- CHANGED: The behavior of the (R)eset button no longer waits to initiate a reset until the timer runs out, and begins the reset function process immediately. Same goes going to/from the (S)etup menu, and is now exiting directly back into the main VPNMON-R2 UI loop without waiting.
- CHANGED: Revamped the reset conditions screens, which now display on a cleared page, instead of appending the reset output to the main UI.
- CHANGED: Joined the reset condition checks together into their own function in order to allow the (R)eset command to work instantaneously, instead of waiting for a cycle to finish.
- FIXED: I "may" have repaired the elusive unbound operand error that would occasionally appear on the main UI.

Download Link below, or update directly through AMTM!
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-2.24.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"

Significant Screenshots:
The NordVPN-only "Use Recommended Servers" is now located under option #6
vpnmon-r2-224-config.jpg


Revamped the reset condition screens to have their own interface, instead of appending to the main UI:
vpnmon-r2-224-reset.jpg
 
Hi @Viktor Jaep, updated to 2.24 this morning and then later observed some errors in your GUI when I did a deliberate WAN Failover by "pulling the plug" on my main WAN 0 connection. I think the @Ranger802004 script "externally resets" your script twice during this process. I think it was on the 2nd cycle, when WAN 0 is "back" and reconnects, that the errors happened.

Can't say if this is different to your 2.24.betas as I only did cursory testing and didn't do any WAN failovers during the beta cycle.

Screenshots follow, note "": bad number" error in shot 1 and the "parse error: Unfinished string ..." in shot 2:-

VPNMON1.jpg

VPNMON2.jpg


Nothing of note in the log I can see?

Code:
Sat Oct  1 08:32:52 AEST 2022 - VPNMON-R2 - Successfully updated VPNMON-R2 from v2.24b6 to v2.24
Sat Oct  1 08:34:05 AEST 2022 - VPNMON-R2 - API call made to update WAN0 city to Sydney
Sat Oct  1 08:34:37 AEST 2022 - VPNMON-R2 - API call made to update WAN city to Sydney
Sat Oct  1 08:34:37 AEST 2022 - VPNMON-R2 - API call made to update VPN city to Sydney
Sat Oct  1 11:03:35 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN CONNECTIVITY ISSUE DETECTED
Sat Oct  1 11:03:35 AEST 2022 - VPNMON-R2 - WAN Link Detected -- Trying to reconnect/Reset VPN
Sat Oct  1 11:03:51 UTC 2022 - VPNMON-R2 ----------> INFO: Executing VPN Reset via Commandline Switch
Sat Oct  1 11:03:51 UTC 2022 - VPNMON-R2 - Executing VPN Reset
Sat Oct  1 11:03:51 UTC 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat Oct  1 11:04:39 AEST 2022 - VPNMON-R2 - Executing VPN Reset
Sat Oct  1 11:04:39 AEST 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat Oct  1 11:06:17 AEST 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat Oct  1 11:06:19 UTC 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat Oct  1 11:06:20 AEST 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 1 from 5 Recommended NordVPN Server Locations
Sat Oct  1 11:06:21 AEST 2022 - VPNMON-R2 - VPN1 Client ON - Lowest PING of 1 VPN slots
Sat Oct  1 11:06:22 UTC 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 1 from 5 Recommended NordVPN Server Locations
Sat Oct  1 11:06:23 UTC 2022 - VPNMON-R2 - VPN1 Client ON - Lowest PING of 1 VPN slots
Sat Oct  1 11:06:25 AEST 2022 - VPNMON-R2 - VPN Reset Finished
Sat Oct  1 11:06:27 UTC 2022 - VPNMON-R2 - VPN Reset Finished
Sat Oct  1 11:06:43 AEST 2022 - VPNMON-R2 - API call made to update WAN city to Sydney
Sat Oct  1 11:06:43 AEST 2022 - VPNMON-R2 - API call made to update VPN city to Sydney
Sat Oct  1 11:07:49 UTC 2022 - VPNMON-R2 ----------> INFO: Executing VPN Reset via Commandline Switch
Sat Oct  1 11:07:49 UTC 2022 - VPNMON-R2 - Executing VPN Reset
Sat Oct  1 11:07:52 UTC 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat Oct  1 11:08:14 UTC 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat Oct  1 11:08:18 UTC 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 1 from 5 Recommended NordVPN Server Locations
Sat Oct  1 11:08:18 UTC 2022 - VPNMON-R2 - VPN1 Client ON - Lowest PING of 1 VPN slots
Sat Oct  1 11:08:22 UTC 2022 - VPNMON-R2 - VPN Reset Finished
Sat Oct  1 11:09:41 AEST 2022 - VPNMON-R2 - API call made to update WAN0 city to Sydney
Sat Oct  1 11:12:59 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN CONNECTIVITY ISSUE DETECTED
Sat Oct  1 11:12:59 AEST 2022 - VPNMON-R2 - WAN Link Detected -- Trying to reconnect/Reset VPN
Sat Oct  1 11:14:03 AEST 2022 - VPNMON-R2 - Executing VPN Reset
Sat Oct  1 11:14:03 AEST 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat Oct  1 11:14:37 AEST 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat Oct  1 11:14:40 AEST 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 1 from 5 Recommended NordVPN Server Locations
Sat Oct  1 11:14:40 AEST 2022 - VPNMON-R2 - VPN1 Client ON - Lowest PING of 1 VPN slots
Sat Oct  1 11:14:44 AEST 2022 - VPNMON-R2 - VPN Reset Finished
Sat Oct  1 11:15:00 AEST 2022 - VPNMON-R2 - API call made to update WAN0 city to Sydney
Sat Oct  1 11:15:30 AEST 2022 - VPNMON-R2 - API call made to update WAN city to Sydney
Sat Oct  1 11:15:30 AEST 2022 - VPNMON-R2 - API call made to update VPN city to Sydney

The 2nd error kept repeating over subsequent 60 second cycles of VPNMON-R2.
It wasn't until I killed out of it with "Control-C" and re-started it that it all came good again.
Any thoughts?
 
Last edited:
@Viktor Jaep I should have added that I had enabled your **NEW** "Recommended Server" option prior to this "test" and that I only have 1 NordVPN slot configured, pretty simple setup - config file follows for your learned perusal!
:D

Code:
TRIES=3
INTERVAL=60
PINGHOST="1.1.1.1"
UpdateVPNMGR=1
USELOWESTSLOT=1
PINGCHANCES=5
UseNordVPN=1
NordVPNSuperRandom=0
NordVPNMultipleCountries=0
NordVPNCountry="Australia"
NordVPNCountry2="0"
NordVPNCountry3="0"
NordVPNLoadReset=50
RecommendedServer=1
UseSurfShark=0
SurfSharkSuperRandom=0
SurfSharkMultipleCountries=0
SurfSharkCountry="United States"
SurfSharkCountry2="0"
SurfSharkCountry3="0"
SurfSharkLoadReset=50
UsePP=0
PPSuperRandom=0
PPMultipleCountries=0
PPCountry="U.S.A."
PPCountry2="0"
PPCountry3="0"
PPLoadReset=50
UseWeVPN=0
WeVPNSuperRandom=0
WeVPNMultipleCountries=0
WeVPNCountry="USA"
WeVPNCountry2="0"
WeVPNCountry3="0"
WeVPNLoadReset=50
UpdateSkynet=1
ResetOption=0
DailyResetTime="00:00"
MINPING=200
N=1
SHOWSTATS=1
DelayStartup=0
TRIMLOGS=1
MAXLOGSIZE=1000
SyncYazFi=0
YF24GN1=0
YF24GN2=0
YF24GN3=0
YF5GN1=0
YF5GN2=0
YF5GN3=0
YF52GN1=0
YF52GN2=0
YF52GN3=0
 
Last edited:

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