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!

Interim v1.5 Beta3 is out there if anyone wants to test any of this new functionality... Here's some of the additions since v1.5b2:
  • Added live feedback during the config process to indicate what the user entered, to hopefully catch typos before getting saved into the config. I thought this would be less messy than showing a huge summary of what all entries would be added to the config at the end of the setup process. Also, note that I'm not giving people feedback on Y/N questions, since these are really hard to screw up. ;) -- thanks @Kal1975
  • Added a new switch called "-screen", which will kick off VPNMON-R2 using the screen utility so we don't have to type this huge commandline each time (usage: "vpnmon-r2.sh -screen") -- thanks @Kal1975
  • Added the WAN connectivity check to the top of the VPN reset function. It will start off by first validating whether or not there's a functional WAN connection before attempting to initiate a VPN connection. WAN connectivity checks continue to be done at each interval to determine if VPNMON-R2 needs to take a back seat until the WAN comes back up.
  • Enhanced the checkwan function and loop for when the WAN goes down. I don't think it worked as advertised in v1.5b2. Please know this is largely untested in a WAN down scenario, and would love to hear your feedback to see if this works. I will try to simulate this when I get a chance.
This will remain on my to-do list, but will release this functionality in a future version...
  • spdMerlin integration that changes which VPN tunnel to run speed tests from when the slots change -- thanks @iTyPsIDg
Beta3
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-1.5b3.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"

Stable:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R2/master/vpnmon-r2-1.4.sh" -o "/jffs/scripts/vpnmon-r2.sh" && chmod a+rx "/jffs/scripts/vpnmon-r2.sh"
 
Last edited:
Don't we all, right? Well, testing RIP didn't last very long. I don't think it's a workable solution. There were 2 issues.

1.) The IP you get from the RIP variable doesn't match the NordVPN exit server, and so when you try to do a Load lookup on that IP, you get 0% back because it's invalid.
2.) The RIP variable didn't seem to get populated immediately, and actually seemed to take some time, which borked up the interface due to the delay.

So as a workaround, I'm using the public IP that I can gather from http://icanhazip.com since that's immediate, and using that to perform a more accurate city lookup. So far so good. ;)
I have a monitor script that uses the VPN connection state and also monitors if it can ping remote tunnel IP.
 
I have a monitor script that uses the VPN connection state and also monitors if it can ping remote tunnel IP.
That's what VPNMON-R2 can do as well, but it pings a remote host of your choice, since just pinging the remote tunnel IP could give you a false indication that the internet is up when it's actually experiencing issues.
 
That's what VPNMON-R2 can do as well, but it pings a remote host of your choice, since just pinging the remote tunnel IP could give you a false indication that the internet is up when it's actually experiencing issues.
I only have specific subnets routed over my tunnel and also my tunnel is a site to site config so it is ideal for my situation. I have dual WAN as well with failover scripts and email notifications so that serves my internet down .
 
I recommend that anywhere you have (Default = X) that Enter uses that default.

1652467639364.png
 
Enhanced the checkwan function and loop for when the WAN goes down. I don't think it worked as advertised in v1.5b2. Please know this is largely untested in a WAN down scenario, and would love to hear your feedback to see if this works. I will try to simulate this when I get a chance.

@Viktor Jaep, installed Beta 3 but I don't think the "WAN Down" functionality is working for me at least. To simulate a "WAN Down" event I pulled the power to my Cable Modem and waited. After a delay I indeed got your screen:-

Code:
VPNMON-R2 is unable to detect a stable WAN connection. Trying to verify connection every 15 seconds...


Please check with your ISP, or reset your modem to re-establish a connection.

The "Spinner" rotated and waited, so I then plugged back in the cable modem and watched the Asus web interface as well. Soon after my RT-AX86U got a connection again, your "Spinner" stopped rotating, but VPNMON-R2 did not resume, just sat there "Frozen". I had to CTRL-C out of it and restart. It then behaved normally.
 
@Viktor Jaep, installed Beta 3 but I don't think the "WAN Down" functionality is working for me at least. To simulate a "WAN Down" event I pulled the power to my Cable Modem and waited. After a delay I indeed got your screen:-

Code:
VPNMON-R2 is unable to detect a stable WAN connection. Trying to verify connection every 15 seconds...


Please check with your ISP, or reset your modem to re-establish a connection.

The "Spinner" rotated and waited, so I then plugged back in the cable modem and watched the Asus web interface as well. Soon after my RT-AX86U got a connection again, your "Spinner" stopped rotating, but VPNMON-R2 did not resume, just sat there "Frozen". I had to CTRL-C out of it and restart. It then behaved normally.
Thanks for the feedback, @Stephen Harrington! I'll try to duplicate this behavior and figure out why it would freeze up during that loop. Weird!
 
The "Spinner" rotated and waited, so I then plugged back in the cable modem and watched the Asus web interface as well. Soon after my RT-AX86U got a connection again, your "Spinner" stopped rotating, but VPNMON-R2 did not resume, just sat there "Frozen". I had to CTRL-C out of it and restart. It then behaved normally.

Question for you, @Stephen Harrington ... how were you running VPNMON-R2? Were you attached with an SSH session, or were you running it with screen directly off the router itself? Wondering if somehow with the WAN coming back on, some network interruption occurred? If you weren't using the screen tool, would you please be so kind to try that, and see if you experience the same issue? ;)
 
Were you attached with an SSH session, or were you running it with screen directly off the router itself?

@Viktor Jaep when I first tried it I was running it via the "-screen" option.

I should note I DO make a small mod to your script (each time I download a new version) and add a "sleep 30" as the first line after the Shebang.
I found this was necessary (after a bit of head-scratching and trial and error experimentation) so that it would "play nicely" with all the other startup scripts (see my signature) that are executing in my setup on a router reboot. If I don't add the delay certain other AMTM scripts never fire off properly it seems. I haven't really nailed it down much more than that as there are obviously some complex interactions, but the "sleep 30" to delay your script works at present. Probably gives a few other crucial things time to fire up and settle?

To fire off your (modified) script I then use "/jffs/scripts/vpnmon-r2.sh -screen &" pretty early in my "post-mount" script.
There is probably a better way of doing it than my ham-fisted attempt and I'm very open to suggestions from those who've had better success!

But I don't THINK any of that has any bearing on the problem at hand ...

When the "WAN Down" recovery in VPNMON-R2 Beta 3 didn't work using my auto-started "-screen" method I then went back and tried it purely using an SSH session via the manual "-monitor" mode.

Same result in each case. Spinner hangs on "WAN Up" and VPNMON-R2 never re-starts monitoring it seems?
 
Last edited:
@Viktor Jaep since I'm annoying you today anyway ... a couple of feature suggestions :p

* On initial install have the option to properly insert the auto-start commands in the appropriate place so that it always fires up on a Router reboot?
* It would be lovely for your stat/display to appear in the Asus GUI (add-on tab next to vpnmgr perhaps?) and/or as a menu selection off the (ssh) AMTM menu, with a single "e" key to exit back to the menu?
* Have Updates appear if available in the AMTM menu as per other scripts?
 
But I don't THINK any of that has any bearing on the problem at hand ...

When the "WAN Down" recovery in VPNMON-R2 Beta 3 didn't work using my auto-started "-screen" method I then went back and tried it purely using an SSH session via the manual "-monitor" mode.

Same result in each case. Spinner hangs on "WAN Up" and VPNMON-R2 never re-starts monitoring it seems?
Thanks for your observations on this, Steve!

I just gave it a quick try this morning, and have different results to share... first off, VPNMON-R2 is running using the screen tool.

1.) I killed my modem by hitting the off button -- router GUI informed me that network cable was detached
2.) VPNMON-R2 seemed like it hung on getting the vpn slot status in its GUI, but eventually overcame it after a minute or so
3.) It then presented me with the red "unable to detect a WAN connection" message, and showed the spinner.
4.) I left it down for a good 5 minutes
5.) Turned the modem back on.
6.) The spinner seemed to hang for a minute after the modem settled, but overcame it.
7.) It then as expected, ran the reset script. It seemed to have some issues with a Yazfi lockfile, and actually ran twice after it didn't seem to make a stable vpn connection the first go-around.
8.) Ended back up in a stable configuration... I checked Yazfi, and I couldn't connect to my guest network. After-the-fact, I ran "sh /jffs/scripts/YazFi runnow" and then it seemed to start working again.

So far, so good! Now we need to figure out why it's hanging on your end. Are you giving it time? I know I was impatient at times thinking it was locked up, but it's just going through some kind of system-decided timeout before it can continue on. I've included my logs below:

Code:
Sat May 14 08:04:50 EDT 2022 - VPNMON-R2 - **VPN4 Ping/http failed**
Sat May 14 08:04:52 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:05:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:05:26 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:05:43 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:00 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:18 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:35 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:52 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:07:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:07:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:07:44 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:01 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:18 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:36 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:53 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:09:10 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:09:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:09:45 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:02 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:19 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:36 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:54 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:11:10 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:11:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:11:45 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:01 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:18 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:35 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:52 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:43 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:43 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:00 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:17 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:34 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:51 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:15:08 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:15:25 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:15:42 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:00 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:17 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:34 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:51 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:17:29 EDT 2022 - VPNMON-R2 - WAN Connection Re-established -- Resetting VPN
Sat May 14 08:17:29 EDT 2022 - VPNMON-R2 - Executing VPN Reset
Sat May 14 08:17:44 EDT 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat May 14 08:17:44 EDT 2022 - VPNMON-R2 - Randomly selected NordVPN Country: United States
Sat May 14 08:18:07 EDT 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 5 from 2031 SuperRandom NordVPN Server Locations
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - Randomly selected VPN2 Client ON
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - Successfully updated YazFi guest network(s) with the current VPN slot.
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - VPN Reset Finished
Sat May 14 08:18:17 EDT 2022 - VPNMON-R2 - **Connection failed** - Executing VPN Reset
Sat May 14 08:18:17 EDT 2022 - VPNMON-R2 - Executing VPN Reset
Sat May 14 08:18:33 EDT 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat May 14 08:18:33 EDT 2022 - VPNMON-R2 - Randomly selected NordVPN Country: Canada
Sat May 14 08:18:52 EDT 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 5 from 288 SuperRandom NordVPN Server Locations
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Randomly selected VPN1 Client ON
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Successfully updated YazFi guest network(s) with the current VPN slot.
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - VPN Reset Finished
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Resuming normal operations
Sat May 14 08:20:02 EDT 2022 - VPNMON-R2 - API call made to update city to Montreal
 
@Viktor Jaep since I'm annoying you today anyway ... a couple of feature suggestions :p

* On initial install have the option to properly insert the auto-start commands in the appropriate place so that it always fires up on a Router reboot?
I think we could make that happen! I'll have that in the official v1.5 release. ;)

* It would be lovely for your stat/display to appear in the Asus GUI (add-on tab next to vpnmgr perhaps?) and/or as a menu selection off the (ssh) AMTM menu, with a single "e" key to exit back to the menu?
Lol. This kind of stuff goes way over my head as a matter of extreme complexity, and would probably need to heavily lean on the developer gurus out there that release these kinds of apps on a regular basis... if they even want to take stuff like this on. I'm not sure the program is at a level of maturity yet to even consider. But I'll keep this idea in my back pocket for the future. ;)
* Have Updates appear if available in the AMTM menu as per other scripts?
This really is up to those in charge of the AMTM tool... I'm sure they don't want to clutter it with tools that come and go... again, not sure if VPNMON-R2 is at that level of maturity to include in there yet, but hope that some day it is presented as an option in AMTM... it would be an honor.
 
Thanks for your observations on this, Steve!

I just gave it a quick try this morning, and have different results to share... first off, VPNMON-R2 is running using the screen tool.

1.) I killed my modem by hitting the off button -- router GUI informed me that network cable was detached
2.) VPNMON-R2 seemed like it hung on getting the vpn slot status in its GUI, but eventually overcame it after a minute or so
3.) It then presented me with the red "unable to detect a WAN connection" message, and showed the spinner.
4.) I left it down for a good 5 minutes
5.) Turned the modem back on.
6.) The spinner seemed to hang for a minute after the modem settled, but overcame it.
7.) It then as expected, ran the reset script. It seemed to have some issues with a Yazfi lockfile, and actually ran twice after it didn't seem to make a stable vpn connection the first go-around.
8.) Ended back up in a stable configuration... I checked Yazfi, and I couldn't connect to my guest network. After-the-fact, I ran "sh /jffs/scripts/YazFi runnow" and then it seemed to start working again.

So far, so good! Now we need to figure out why it's hanging on your end. Are you giving it time? I know I was impatient at times thinking it was locked up, but it's just going through some kind of system-decided timeout before it can continue on. I've included my logs below:

Code:
Sat May 14 08:04:50 EDT 2022 - VPNMON-R2 - **VPN4 Ping/http failed**
Sat May 14 08:04:52 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:05:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:05:26 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:05:43 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:00 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:18 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:35 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:06:52 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:07:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:07:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:07:44 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:01 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:18 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:36 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:08:53 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:09:10 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:09:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:09:45 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:02 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:19 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:36 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:10:54 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:11:10 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:11:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:11:45 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:01 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:18 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:35 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:12:52 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:43 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:09 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:27 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:13:43 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:00 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:17 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:34 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:14:51 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:15:08 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:15:25 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:15:42 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:00 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:17 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:34 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:16:51 EDT 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sat May 14 08:17:29 EDT 2022 - VPNMON-R2 - WAN Connection Re-established -- Resetting VPN
Sat May 14 08:17:29 EDT 2022 - VPNMON-R2 - Executing VPN Reset
Sat May 14 08:17:44 EDT 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat May 14 08:17:44 EDT 2022 - VPNMON-R2 - Randomly selected NordVPN Country: United States
Sat May 14 08:18:07 EDT 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 5 from 2031 SuperRandom NordVPN Server Locations
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - Randomly selected VPN2 Client ON
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - Successfully updated YazFi guest network(s) with the current VPN slot.
Sat May 14 08:18:14 EDT 2022 - VPNMON-R2 - VPN Reset Finished
Sat May 14 08:18:17 EDT 2022 - VPNMON-R2 - **Connection failed** - Executing VPN Reset
Sat May 14 08:18:17 EDT 2022 - VPNMON-R2 - Executing VPN Reset
Sat May 14 08:18:33 EDT 2022 - VPNMON-R2 - Killed all VPN Client Connections
Sat May 14 08:18:33 EDT 2022 - VPNMON-R2 - Randomly selected NordVPN Country: Canada
Sat May 14 08:18:52 EDT 2022 - VPNMON-R2 - Updated Skynet Whitelist
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Refreshed VPN Slots 1 - 5 from 288 SuperRandom NordVPN Server Locations
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Randomly selected VPN1 Client ON
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Successfully updated YazFi guest network(s) with the current VPN slot.
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - VPN Reset Finished
Sat May 14 08:18:58 EDT 2022 - VPNMON-R2 - Resuming normal operations
Sat May 14 08:20:02 EDT 2022 - VPNMON-R2 - API call made to update city to Montreal
Yea I am still trying to find the hang-up.... Your script seems to be running very well for my setup ( not that it is a bad thing, but my test system is a bit vanilla compared to some of the average users. I am to the point now where I feel I need to install other scripts to create the same environment inducing symptoms.).

@Viktor Jaep when I first tried it I was running it via the "-screen" option.

I should note I DO make a small mod to your script (each time I download a new version) and add a "sleep 30" as the first line after the Shebang.
I found this was necessary (after a bit of head-scratching and trial and error experimentation) so that it would "play nicely" with all the other startup scripts (see my signature) that are executing in my setup on a router reboot. If I don't add the delay certain other AMTM scripts never fire off properly it seems. I haven't really nailed it down much more than that as there are obviously some complex interactions, but the "sleep 30" to delay your script works at present. Probably gives a few other crucial things time to fire up and settle?

To fire off your (modified) script I then use "/jffs/scripts/vpnmon-r2.sh -screen &" pretty early in my "post-mount" script.
There is probably a better way of doing it than my ham-fisted attempt and I'm very open to suggestions from those who've had better success!

But I don't THINK any of that has any bearing on the problem at hand ...

When the "WAN Down" recovery in VPNMON-R2 Beta 3 didn't work using my auto-started "-screen" method I then went back and tried it purely using an SSH session via the manual "-monitor" mode.

Same result in each case. Spinner hangs on "WAN Up" and VPNMON-R2 never re-starts monitoring it seems?

did you ever think about placing the script as the last one to run? Also, I am curious as to why it would impact your other scripts as well? do you have any personal lines of code in these same starting scripts?
 
So far, so good! Now we need to figure out why it's hanging on your end. Are you giving it time? I know I was impatient at times thinking it was locked up, but it's just going through some kind of system-decided timeout before it can continue on. I've included my logs below:

@Viktor Jaep I gave it another go this morning in case I wasn't giving it enough time. Gave it a good 10 minutes after I plugged the Cable Modem back in. From my logs it seems like once VPNMON-R2 sees the WAN come back up, it kind of "hangs" (which is when I see your "spinner" stop) and can't do the restart of normal monitoring. I see no more "ERROR : WAN DOWN" entries in log (which is logical) but neither do I ever see a "WAN Connection Re-established -- Resetting VPN" like happens in your logs.

Code:
Sun May 15 09:25:47 AEST 2022 - VPNMON-R2 - **VPN1 Ping/http failed**
Sun May 15 09:25:49 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:26:06 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:26:23 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:26:40 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:26:57 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:27:14 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:27:31 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:27:48 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:28:04 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:28:20 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:28:36 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:28:52 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:29:08 AEST 2022 - VPNMON-R2 ----------> ERROR: WAN DOWN
Sun May 15 09:35:05 AEST 2022 - VPNMON-R2 - API call made to update city to Sydney

The last "WAN DOWN" entry in the log just precedes (within 15 seconds) when the WAN came back in the Asus web interface and your "spinner" freezes. After that nothing until I hit "CTRL-C" 5 minutes later and restart VPNMON-R2, which is the "VPNMON-R2 - API call made to update city to Sydney" entry, whereupon it all runs normally again. So it seems like VPNMON is detecting the WAN coming up (the spinner freezing), but then can't for some reason "resume normal service"?

May I suggest you may need to put some more granular/verbose logging in place to help me help you track this down further perhaps?

For background, my VPNMON-R2 config is very simple - single NordVPN client in Slot 1 set always to Australia with no Random or SuperRandom, Skynet Updated, VPNMgr in use, No YazFi, No Daily Reset, numeric values all set on defaults I think.

Code:
TRIES=3
INTERVAL=60
PINGHOST="8.8.8.8"
UpdateVPNMGR=1
UseNordVPN=1
NordVPNSuperRandom=0
NordVPNMultipleCountries=0
NordVPNCountry="Australia"
NordVPNCountry2=""
NordVPNCountry3=""
NordVPNLoadReset=50
UpdateSkynet=1
ResetOption=0
DailyResetTime="00:00"
N=1
SHOWSTATS=1
SyncYazFi=0
YF24GN1=0
YF24GN2=0
YF24GN3=0
YF5GN1=0
YF5GN2=0
YF5GN3=0
YF52GN1=0
YF52GN2=0
YF52GN3=0

Just as a reality check and to be really sure I tested it without the "/jffs/scripts/vpnmon-r2.sh -screen" auto-start line in post-mount as well and rebooted. I commented out my "sleep 30" entry at the top of your script to rule this out as a factor. I then ran it up manually just using "./vpnmon-r2.sh -monitor" in an SSH session and tried "WAN Down" test again - same result.

As an aside, is post-mount the right place to be doing the auto-start? Are there other options?
 
Last edited:
did you ever think about placing the script as the last one to run? Also, I am curious as to why it would impact your other scripts as well? do you have any personal lines of code in these same starting scripts?

I've got no other "personal" lines in post-mount that aren't inserted by the various AMTM installers. Yep, I initially tried it as the last line in post-mount. I could tell by doing a "cru l" that some of the other scripts weren't running properly as I wasn't getting the right number of cron entries showing up. I then tried it as the first line but that made no difference (so I just left it there). It was only when I put the delay at the top of the vpnmon-r2 script that a "cru l" came up with correct number of lines. 15 seconds was too short, 30 seconds was OK. So far haven't tuned it more than that or tracked down exactly which cron entries are missing without the delay inserted - my next step if I get time would be to figure out line-by-line exactly which AMTM script(s) are not completing properly. Probably like most of us I have limited windows of opportunity to play with this stuff before someone in the household complains about "there's no internet - are you playing with something AGAIN!"

:p
 
Last edited:
I've got no other "personal" lines in post-mount that aren't inserted by the various AMTM installers. Yep, I initially tried it as the last line in post-mount. I could tell by doing a "cru l" that some of the other scripts weren't running properly as I wasn't getting the right number of cron entries showing up. I then tried it as the first line but that made no difference (so I just left it there). It was only when I put the delay at the top of the vpnmon-r2 script that a "cru l" came up with correct number of lines. 15 seconds was too short, 30 seconds was OK. So far haven't tuned it more than that or tracked down exactly which cron entries are missing without the delay inserted - my next step if I get time would be to figure out line-by-line exactly which AMTM script(s) are not completing properly. Probably like most of us I have limited windows of opportunity to play with this stuff before someone in the household complains about "there's no internet - are you playing with something AGAIN!"

:p
:) Likewise, Steve... This weekend is all about family, and in my occasional time of freedom, I'm doing research. I believe post-mount is the right place to put this. I don't see why it shouldn't work from there.

Also, I'm looking to see if there's an opportunity to use a different method to check the WAN. I found that there is a included wan-event script available that might be able to give me some indicators that I'll need to play with. ;)
 
Also, I'm looking to see if there's an opportunity to use a different method to check the WAN. I found that there is a included wan-event script available that might be able to give me some indicators that I'll need to play with.

Thanks for having a look, the fact I can reproduce this issue “manually” if I just run it with the “-monitor” switch means I think that it’s nothing to do with Screen or post-mount. Maybe it’s model-specific?

Enjoy your weekend, mine’s nearly over down here …

:)
 
Thanks for having a look, the fact I can reproduce this issue “manually” if I just run it with the “-monitor” switch means I think that it’s nothing to do with Screen or post-mount. Maybe it’s model-specific?

Enjoy your weekend, mine’s nearly over down here …

:)
Thanks Steve! I found a few minutes, and have another version I'll post later tonight (on the other side of the world). I hope this one helps overcome the freeze you're experiencing. ;)
 
:) Likewise, Steve... This weekend is all about family, and in my occasional time of freedom, I'm doing research. I believe post-mount is the right place to put this. I don't see why it shouldn't work from there.

Also, I'm looking to see if there's an opportunity to use a different method to check the WAN. I found that there is a included wan-event script available that might be able to give me some indicators that I'll need to play with. ;)
Vicktor, I'm testing a few last things on my wan-failover script and then I can share with you, on there for my wan failure detections I ping a target IP Address over a specific interface (WAN) and have a specific ping count and look for 100% packet loss, so for example if my ping misses 3 pings it will continue to the failover function.
 
:) Likewise, Steve... This weekend is all about family, and in my occasional time of freedom, I'm doing research. I believe post-mount is the right place to put this. I don't see why it shouldn't work from there.

Also, I'm looking to see if there's an opportunity to use a different method to check the WAN. I found that there is a included wan-event script available that might be able to give me some indicators that I'll need to play with. ;)
I appreciate your work! Your valiant efforts are remarkable. Thank you for the continuous improvements.
 

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!

Staff online

Top