What's new

check if VPN is working with ping

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

Sia7asH

Occasional Visitor
Hello to all
I have 2 VPN connection that always runs with modem start , and sometimes one of my VPN is not working and i have to disable it and enable it again manually though it is still connect but doesn't open anything , is there any chance that you add some feature that test a vpn connection occasionally with ping and if the vpn is not working then switch to next vpn connection automatically ? something like the failover section in Dual WAN mode ?
thank you very much
 
Welcome to the forums @Sia7asH.

Have you looked at the forums? Have you tried Better Search (at the top of the page)?

Have you tried searching via google with the site: www.snbforums.com appended for further search results?
 
I assume we're talking about OpenVPN client here.

It is possible to get a failed OpenVPN client (re)started, at least if the failure is NON fatal (e.g., invalid username/password).


However, configuring for failover (and perhaps even failback) is another thing entirely. Realize the OpenVPN clients are prioritized, w/ client #1 having the highest, client #5 the lowest. As such, under certain circumstances (e.g., no kill switch), it is possible for a failed OpenVPN client (or one that never got started for some reason) to cause traffic to be routed via the next lower priority OpenVPN client, provided the routing rules allow it (i.e., VPN Director). In that sense, there is a limited amount of failover capability. And if the failed OpenVPN client is restored or finally started, it could be seen as a form of failback.
 
I assume we're talking about OpenVPN client here.

It is possible to get a failed OpenVPN client (re)started, at least if the failure is NON fatal (e.g., invalid username/password).


However, configuring for failover (and perhaps even failback) is another thing entirely. Realize the OpenVPN clients are prioritized, w/ client #1 having the highest, client #5 the lowest. As such, under certain circumstances (e.g., no kill switch), it is possible for a failed OpenVPN client (or one that never got started for some reason) to cause traffic to be routed via the next lower priority OpenVPN client, provided the routing rules allow it (i.e., VPN Director). In that sense, there is a limited amount of failover capability. And if the failed OpenVPN client is restored or finally started, it could be seen as a form of failback.
yes , I'm exactly talking about openVPN clients ,I have 2 Openvpn clients that sometimes one of my VPN is not working and i have to disable it and enable it again manually though it is still connect but doesn't open anything .
So you are saying that if I use this script via SSH , there is no need to manually disable and enable the OpenVPN client again and it will route to openVPN client #2 , right?
 
yes , I'm exactly talking about openVPN clients ,I have 2 Openvpn clients that sometimes one of my VPN is not working and i have to disable it and enable it again manually though it is still connect but doesn't open anything .
So you are saying that if I use this script via SSH , there is no need to manually disable and enable the OpenVPN client again and it will route to openVPN client #2 , right?

The purpose of the script is to act as a watchdog. It will monitor the tunnel for failed pings, as well as start or restart the OpenVPN client if the connection fails for other reasons. But this assumes the OpenVPN client is actually restartable. IOW, if the failure is due to an unavailable server, and that's the *only* server you specified for that OpenVPN client (so there are no other options), then of course the OpenVPN client will never get (re)started.

So that solves that particular problem. And for any and all concurrently active OpenVPN clients.

As far as failover/failback, as I said, you have a certain amount of such capability built into the OpenVPN implementation in this regard, due to the OpenVPN clients having a fixed priority. You just have to be careful how you configure those clients to make that happen. But if you can improve the reliability of your OpenVPN connections w/ the script, maybe the issue of failover/failback is moot!
 
The purpose of the script is to act as a watchdog. It will monitor the tunnel for failed pings, as well as start or restart the OpenVPN client if the connection fails for other reasons. But this assumes the OpenVPN client is actually restartable. IOW, if the failure is due to an unavailable server, and that's the *only* server you specified for that OpenVPN client (so there are no other options), then of course the OpenVPN client will never get (re)started.

So that solves that particular problem. And for any and all concurrently active OpenVPN clients.

As far as failover/failback, as I said, you have a certain amount of such capability built into the OpenVPN implementation in this regard, due to the OpenVPN clients having a fixed priority. You just have to be careful how you configure those clients to make that happen. But if you can improve the reliability of your OpenVPN connections w/ the script, maybe the issue of failover/failback is moot!
Thank you so much for your help and Script , just another question , I just have to SSH ( with putty ) into my modem and copy/paste the script into the window and It will automatically create and install the script right?!and after that i can turn off ssh ( for security reasons ) and disable JFFS custom scripts and configs , right?
sorry for asking because I've never used SSH to my modem ( dsl-ax82u)!

P.S : just one more thing , if I want to change the script after i copy/paste the script into modem , how should i do it? and if I want to delete the script from modem what should I do? sorry for asking so many questions
 
Last edited:
You can turn off ssh, but if you turn off/disable JFFS custom scripts and configs, you've disabled the ability for the script to run at all.
 
Thank you again , but when I'm using :
Code:
nano /jffs/scripts/services-start
it says :
Code:
nano : not found
 
Thank you again , but when I'm using :
Code:
nano /jffs/scripts/services-start
it says :
Code:
nano : not found

Maybe your firmware only has the vi editor. I assume this is Merlin firmware, which should also support nano. Worst case, you can use WinSCP to download, edit (w/ built-in editor), and upload the changes.
 
Maybe your firmware only has the vi editor. I assume this is Merlin firmware, which should also support nano. Worst case, you can use WinSCP to download, edit (w/ built-in editor), and upload the changes.
I have Asuswrt-merlin the latest stable version 386.5_2-gnuton0
 
I have Asuswrt-merlin the latest stable version 386.5_2-gnuton0

It should at least have the vi editor. It's just not as user-friendly as the nano editor. As I said, using something like WinSCP might be easier for some ppl, esp. for extensive editing. But for a quick and short edit, vi will usually suffice.
 
It should at least have the vi editor. It's just not as user-friendly as the nano editor. As I said, using something like WinSCP might be easier for some ppl, esp. for extensive editing. But for a quick and short edit, vi will usually suffice.
I've installed WinSCP , Can you please tell me the location of the script so i can edit it?!
 
@eibgrad
Hello again sir
I just reset factory my modem and I'm trying to install your script and i reboot my modem as you mentioned but when with winscp I connect to my modem and go to the /jffs/scripts/ directory , there is nothing there !
what can I do?
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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

Members online

Top