What's new

VPNMON VPNMON-R3 v1.3.7 -Oct 20, 2024- Monitor WAN/Dual-WAN/OpenVPN Health & Reset Multiple OpenVPN Connections (Now available in AMTM!)

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

New v0.4b with an added ping value for each connected VPN tunnel. I thought it would be nice to get at least SOME visibility on each connection... and other minor fixes/enhancements. :)

What's new?
v0.4b
- ADDED:
Relented and included a single PING indicator across the VPN tunnel to at least show some stats of what's going on with the connection. Formatted to handle 4 digits and 3 decimals, we should be good for the worse of worsest situations. On the fence of supporting a > amount ping reset condition.
- FIXED: Eliminated many script restarts after exiting various menus and allows you to return to the main UI without interference to the VPN city and Unbound Sync lookups.
- FIXED: Based on the timezone code length, the main UI bar now fixes its size so it stays a uniform length.

Download link:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R3/main/vpnmon-r3-0.4b.sh" -o "/jffs/scripts/vpnmon-r3.sh" && chmod 755 "/jffs/scripts/vpnmon-r3.sh"

Significant Screenshots:

Screen has been widened slightly to accommodate the new PING column.
1701968595601.png


Any other suggestions to add to the operations menu that would be nice-to-have at your fingertips?
 
Wild thought... what's your opinion on bringing over some KILLMON Killswitch functionality into R3 and integrating it? I envision using a list method much like maintaining a list of IPs to be included in the Killswitch affected devices list? Any takers?
 
Wild thought... what's your opinion on bringing over some KILLMON Killswitch functionality into R3 and integrating it? I envision using a list method much like maintaining a list of IPs to be included in the Killswitch affected devices list? Any takers?

Don't really use killmon, but a functionality that I would welcome, is the “Connect to the fastest server” :)
 
Don't really use killmon, but a functionality that I would welcome, is the “Connect to the fastest server” :)
You can use a custom CURL statement to achieve this... luckily NordVPN allows you to do this... not many other VPN providers have this capability. Here's how:

First, you need to determine the country ID for your country of origin:
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | select(.name == "United States") | [.name,.id] | "\(.[1])"'

(For a list of all supported countries with their country IDs, you can also run this)
Code:
curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[] | [.id, .name] | @tsv'

In my case, "United States" = 228. Then, using the 228 code that it spits out, insert/replace that into the recommended servers query below:
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors "https://api.nordvpn.com/v1/servers/recommendations?filters\[country_id\]=228&limit=5" | jq --raw-output '.[].station'

As long as you have that CountryID, this statement wouldn't change, and could easily insert this into VPNMON-R3 under your server list automation.
 
Last edited:
Is there any reason why I can't select 2 (or 4) VPN slots in the setup menu? the only choices it will allow is 3 or 5
With this configuration (3 selected) and I only have 2 slots configured in my router (slot 2 is disabled/off), I appear to be stuck in an infinite loop

I just keep going around with these messages, and I can't configure/update etc. anything.
Stopping VPN Client 2
Staring VPN Client 2
Restarting Routing

I've resorted to rebooting the router and uninstalling VPNMON-R3 for now.

On a side note, if I am using VPNMON-R3, do I need to disable or uninstall VPNMON-R2?
 
Last edited:
Is there any reason why I can't select 2 (or 4) VPN slots in the setup menu? the only choices it will allow is 3 or 5
With this configuration (3 selected) and I only have 2 slots configured in my router (slot 2 is disabled/off), I appear to be stuck in an infinite loop

I just keep going around with these messages, and I can't configure/update etc. anything.
Stopping VPN Client 2
Staring VPN Client 2
Restarting Routing

I've resorted to rebooting the router and uninstalling VPNMON-R3 for now.

On a side note, if I am using VPNMON-R3, do I need to disable or uninstall VPNMON-R2?
Hi,

When selecting the number of slots (3 or 5), you are selecting the "actual" number of VPN's slots that your router is capable of creating, I believe... The number of VPN's that the script will "manage" you select in the menu, after installing the script...

"The number of options are short & sweet (compared to VPNMON-R2). Here you can specify how many VPN Client Slots you have available (some routers only have 3 due to NVRAM size limitations), which custom host you want to use to PING against, how large you want your event log to grow to, and whether or not you want to enable the Unbound-over-VPN integration."

You have to uninstall VPNMON-R2, they are doing "almost" the same thing, that is keeping tabs on your VPN connections...It's one or the other
 
Last edited:
Hi,

When selecting the number of slots (3 or 5), you are selecting the "actual" number of VPN's slots that your router is capable of creating, I believe... The number of VPN's that the script will "manage" you select in the menu, after installing the script...

"The number of options are short & sweet (compared to VPNMON-R2). Here you can specify how many VPN Client Slots you have available (some routers only have 3 due to NVRAM size limitations), which custom host you want to use to PING against, how large you want your event log to grow to, and whether or not you want to enable the Unbound-over-VPN integration."

You have to uninstall VPNMON-R2, they are doing "almost" the same thing, that is keeping tabs on your VPN connections...It's one or the other
That makes more sense, thank you @kuki68ster
I'll give it another go and report back
 
That makes more sense, thank you @kuki68ster
I'll give it another go and report back
You definitely want to stop R2... but if you have your slot 2 not active, don't make it as being monitored by R3. Sorry... hope to have more time this evening to respond. ;)
 
Ok, so I've now removed VPNMON-R2 and reinstalled VPNMON-R3

It's looking a little better, however I'm still seeing a few quirks - my favourite "unknown operand" is back :p
Why is VPN3 displayed when I've selected it not to be monitored? does it need to be shown?

Code:
  VPNMON-R3 - v0.4b | (S)how/(H)ide Operations Menu |

  Slot | Mon |  Svrs  | Health | VPN State    | Public VPN IP   | Ping-->VPN | City Exit
-------|-----|--------|--------|--------------|-----------------|------------|-----------------------
  VPN1 | [X] | [0000] | [ OK ] | Connected    | xxx.xxx.xxx.xxx | [0096.771] | xxxxxx
[: Internet: unknown operand
printf: invalid number 'no'
printf: invalid number 'Internet'
printf: invalid number 'traffic'
printf: invalid number ''
  VPN2 | [X] | [0000] | [ OK ] | Connected    | 000.000.000.000 | [0030.695] | null
  VPN3 | [ ] | [0000] | [n/a ] | Disconnected | [n/a]           | [n/a ]     | [n/a]
-------|-----|--------|--------|--------------|-----------------|------------|-----------------------

Edit: one more minor update - I believe in R2, it would auto populate the VPN Server name on the GUI page, R3 doesn't seem to do that? any chance you could add that functionality back in?
 
Last edited:
Ok, so I've now removed VPNMON-R2 and reinstalled VPNMON-R3

It's looking a little better, however I'm still seeing a few quirks - my favourite "unknown operand" is back :p
Why is VPN3 displayed when I've selected it not to be monitored? does it need to be shown?

Code:
  VPNMON-R3 - v0.4b | (S)how/(H)ide Operations Menu |

  Slot | Mon |  Svrs  | Health | VPN State    | Public VPN IP   | Ping-->VPN | City Exit
-------|-----|--------|--------|--------------|-----------------|------------|-----------------------
  VPN1 | [X] | [0000] | [ OK ] | Connected    | xxx.xxx.xxx.xxx | [0096.771] | xxxxxx
[: Internet: unknown operand
printf: invalid number 'no'
printf: invalid number 'Internet'
printf: invalid number 'traffic'
printf: invalid number ''
  VPN2 | [X] | [0000] | [ OK ] | Connected    | 000.000.000.000 | [0030.695] | null
  VPN3 | [ ] | [0000] | [n/a ] | Disconnected | [n/a]           | [n/a ]     | [n/a]
-------|-----|--------|--------|--------------|-----------------|------------|-----------------------

Edit: one more minor update - I believe in R2, it would auto populate the VPN Server name on the GUI page, R3 doesn't seem to do that? any chance you could add that functionality back in?

1. Run the script again and select the option to install the entware dependencies...

2. The script will show all the VPN client slots available on your router... Only when the X appears on the MON field, is that the VPN client slot is being monitored...

3. R3 autopopulate when the connection has been reseted by the script... R2 has more specific options linked to the VPN provider, like Nord VPN (Recommended Server, etc.) that R3 doesn't have... In the future, maybe Viktor Jaep will add, maybe not...
 
1. Run the script again and select the option to install the entware dependencies...

2. The script will show all the VPN client slots available on your router... Only when the X appears on the MON field, is that the VPN client slot is being monitored...

3. R3 autopopulate when the connection has been reseted by the script... R2 has more specific options linked to the VPN provider, like Nord VPN (Recommended Server, etc.) that R3 doesn't have... In the future, maybe Viktor Jaep will add, maybe not...
Thanks for your help, that seems to work now :D
 
Ok, so I've now removed VPNMON-R2 and reinstalled VPNMON-R3

It's looking a little better, however I'm still seeing a few quirks - my favourite "unknown operand" is back :p
Why is VPN3 displayed when I've selected it not to be monitored? does it need to be shown?

Code:
  VPNMON-R3 - v0.4b | (S)how/(H)ide Operations Menu |

  Slot | Mon |  Svrs  | Health | VPN State    | Public VPN IP   | Ping-->VPN | City Exit
-------|-----|--------|--------|--------------|-----------------|------------|-----------------------
  VPN1 | [X] | [0000] | [ OK ] | Connected    | xxx.xxx.xxx.xxx | [0096.771] | xxxxxx
[: Internet: unknown operand
printf: invalid number 'no'
printf: invalid number 'Internet'
printf: invalid number 'traffic'
printf: invalid number ''
  VPN2 | [X] | [0000] | [ OK ] | Connected    | 000.000.000.000 | [0030.695] | null
  VPN3 | [ ] | [0000] | [n/a ] | Disconnected | [n/a]           | [n/a ]     | [n/a]
-------|-----|--------|--------|--------------|-----------------|------------|-----------------------

Edit: one more minor update - I believe in R2, it would auto populate the VPN Server name on the GUI page, R3 doesn't seem to do that? any chance you could add that functionality back in?

Not sure how you are prone to getting these unknown operand errors, but it seems to be coming from VPN2. Does this connection work for you? It's giving some weird feedback, like "no internet traffic", and not returning an external public IP address. Might need some troubleshooting there to validate that this is all working right on your end? It might also be that you're blocking some API urls that are needed for this functionality to work. But if they work in R2, they should work in R3.

And @kuki68ster is absolutely correct... you need to choose either a 3 or 5 VPN slot config. It just shows total capabilities for your router, and whether you want to enable/disable monitoring for any of these slots, whether they're in use or not.

R3 is very vpn-provider-independent. I'm not using any hooks into any VPN providers to get further server context. Just the IP address based on your predefined list. You could use hostnames too if you want, instead of IP addresses, which would display in your UI that way (if your VPN provider supports that method).

EDIT:
I'm pretty sure for some reason it's failing on this code with those unknown operands:

Code:
  icanhazvpnip=$($timeoutcmd$timeoutsec nvram get vpn_client$1_rip)
  if [ -z $icanhazvpnip ]; then
    icanhazvpnip=$(curl --silent --fail --interface $TUN --request GET --url https://ipv4.icanhazip.com) # Grab the public IP of the VPN Connection
  fi
  vpnip=$(printf '%03d.%03d.%03d.%03d'  ${icanhazvpnip//./ })

First, it tries to get the public VPN IP from your "vpn_clientX_rip" field in NVRAM. If that fails, then it tries to grab it from https://ipv4.icanhazip.com... so if icanhazip.com is coming back with a "no internet traffic" error of some sort, then that error message is getting inserted into the following printf statement that would normally be parsing the IP address for display. I will need to add another validation here to determine if what it's getting back isn't an IP address to help with this scenario.
 
Last edited:
@TITAN, give this command a try and let me know what returns? You need to run this while you're seeing those unknown operand errors...

Code:
curl --silent --fail --interface tun12 --request GET --url https://ipv4.icanhazip.com
 
Last edited:
VPN Client Slot Server List Automation
Hello, great job with new R3 script, really like the more flexible approach like provider independance and server list customization via command prompts.

However, let me understand more details about the refresh of VPN server listi.e.
  1. What triggers the refresh of curl command => list of IP addresses ?
  2. How do you work with the list, do you randomly pick one of IP addresses ?
  3. I have not seen this mention in the description but in the code there are still external commands like '-reset', does it work like with R2 ?
Thanks
 
Hello, great job with new R3 script, really like the more flexible approach like provider independance and server list customization via command prompts.
Thanks!! That was the idea... making it flexible to work with anything. ;)

However, let me understand more details about the refresh of VPN server listi.e.
  1. What triggers the refresh of curl command => list of IP addresses ?
Right now it's a manual process. You would go into the VPN Client Slot Server List Automation screen, and execute the query you want (using keys e1 - e5) in order to update the list. I have some plans in the works to automate this update through the means of a -switch and cron job. Luckily these server IPs don't change too often, so you are probably safe for a while, but definitely need to be refreshed every so often.

  1. How do you work with the list, do you randomly pick one of IP addresses ?
VPNMON-R3 will randomly pick a server from the list...

  1. I have not seen this mention in the description but in the code there are still external commands like '-reset', does it work like with R2 ?
It certainly does have a -reset switch, which it uses when you configure an automated reset under the "R" option. Here's a list of options:

Code:
VPNMON-R3 v0.5b Commandline Option Usage:

vpnmon-r3 -h | -help
vpnmon-r3 -setup
vpnmon-r3 -reset
vpnmon-r3 -bw
vpnmon-r3 -screen

 -h | -help (this output)
 -setup (displays the setup menu)
 -reset (resets vpn connections and exits)
 -bw (runs vpnmon-r3 in monochrome mode)
 -screen (runs vpnmon-r3 in screen background)

@salvo ... I am creating some examples and tutorials on how to create your own lists here: https://www.snbforums.com/threads/v...list-generation-tutorials-and-examples.88022/
 
Last edited:
@TITAN, give this command a try and let me know what returns? You need to run this while you're seeing those unknown operand errors...

Code:
curl --silent --fail --interface tun12 --request GET --url https://ipv4.icanhazip.com
@TITAN would you be able to give this a shot?
 
Right now it's a manual process. You would go into the VPN Client Slot Server List Automation screen, and execute the query you want (using keys e1 - e5) in order to update the list. I have some plans in the works to automate this update through the means of a -switch and cron job. Luckily these server IPs don't change too often, so you are probably safe for a while, but definitely need to be refreshed every so often.
You're right about the IP addresses. The only point where it might be relevant to update more often is to use the TOP5 recommended IP addresses from the NordVPN API. I assume they change more often, but I'm not sure how often, do you know ?
 
You're right about the IP addresses. The only point where it might be relevant to update more often is to use the TOP5 recommended IP addresses from the NordVPN API. I assume they change more often, but I'm not sure how often, do you know ?
I'm sure they change by the hour, depending on load... or what new servers they've added or taken down.
 
Release of v0.5b today... Awaiting feedback from @TITAN to validate that this fix works for him with the issue he had. Enjoy!!

What's new?
v0.5b
- ADDED:
Created a new row under the Operations Menu to allow you to quickly stop + unmonitor a VPN Slot. This was added to give you some more control over a VPN Client Slot that might be giving you trouble, or don't want to have to go into the router UI to forcefully stop a VPN Client Slot. Performing this action will also remove it from the monitored list, so it doesn't immediately try to reconnect it.
- ADDED: Created a thread with tutorials and examples on how to craft custom CURL+JQ statements in order to query specific city and/or country IP address list from various VPN providers using their APIs. This is thread is available here: https://www.snbforums.com/threads/v...list-generation-tutorials-and-examples.88022/
- FIXED: Added some validation on obtaining the public VPN IP address in case NVRAM could not produce it, and icanhazip.com comes back with an error message. Thanks to @TITAN for bringing this up.
- FIXED: General cleanup of inconsistencies that kept bugging me. ;)

Download Link:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/VPNMON-R3/main/vpnmon-r3-0.5b.sh" -o "/jffs/scripts/vpnmon-r3.sh" && chmod 755 "/jffs/scripts/vpnmon-r3.sh"

Significant Screenshots:

Operations Menu has been reworked some, and added a new row to Stop/Unmonitor VPN Slots (which correspond to the Client Slot #1 directly above).
1702756888512.png
 

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