What's new

Solved WAN AutoReconnect Questions

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

minimos

Occasional Visitor
Hi,

I have had a number of instances this year where my XT8 is up and running as normal, i.e it is serving the WebUI, Wifi and you can log into SSH, the GUI shows internet connected, but there is no connectivity on the external WAN connection.

The separate modem is also connected and synced, and to make everything work again, you can go to the WAN section of the admin, click apply and everything starts working again. I suspect something is happening on the WAN interface that makes it look like it is down, but clicking apply restarts the interface and everything is up and running again.

It's a very infrequent occurrence, maybe 2 or 3 times this year, but once it did happen when I was out of the house on holiday so it messed with my home automation stuff and I could not use the VPN.

So I started looking into a potential solution, and came across the ChkWAN script GitHub - MartineauUK/Chk-WAN: ASUS Router Check WAN status which looks like a solution especially as it can attempt the WAN restart before doing a reboot. However whilst researching how to set that up I came across this thread on SNB Does Asuswrt-Merlin auto reconnect WAN on disconnect or modem reset? | SmallNetBuilder Forums (snbforums.com).

The upshoot seems to be that some of this functionality is now built into the firmware, however there does not appear to be much information on how the router recovers and what options I would need to set?

I currently have 'Internet Detection' disabled in the WAN section of the UI, and I assume enabling this will probably enable the functionality. However, there is not much information on what the 2 options do from a quick google search.

Can anyone confirm what happens if the either PPP or DNS Probe do not return an expected value? What is the best option to use on a PPoE connection? How do I specify a DNS server or site to lookup? How do you configure frequency of DNS probe like with PPP options? What would be shown in then logs if the restart functionality had kicked in? Does the router reboot at any point or is it just an interface restart.

As you can tell I have lots of questions but there does not appear to be much info on what the functionality actually does and how to utilise it.

Thanks for any insight you can provide
 
Hi,

I have had a number of instances this year where my XT8 is up and running as normal, i.e it is serving the WebUI, Wifi and you can log into SSH, the GUI shows internet connected, but there is no connectivity on the external WAN connection.

The separate modem is also connected and synced, and to make everything work again, you can go to the WAN section of the admin, click apply and everything starts working again. I suspect something is happening on the WAN interface that makes it look like it is down, but clicking apply restarts the interface and everything is up and running again.

It's a very infrequent occurrence, maybe 2 or 3 times this year, but once it did happen when I was out of the house on holiday so it messed with my home automation stuff and I could not use the VPN.

So I started looking into a potential solution, and came across the ChkWAN script GitHub - MartineauUK/Chk-WAN: ASUS Router Check WAN status which looks like a solution especially as it can attempt the WAN restart before doing a reboot. However whilst researching how to set that up I came across this thread on SNB Does Asuswrt-Merlin auto reconnect WAN on disconnect or modem reset? | SmallNetBuilder Forums (snbforums.com).

The upshoot seems to be that some of this functionality is now built into the firmware, however there does not appear to be much information on how the router recovers and what options I would need to set?

I currently have 'Internet Detection' disabled in the WAN section of the UI, and I assume enabling this will probably enable the functionality. However, there is not much information on what the 2 options do from a quick google search.

Can anyone confirm what happens if the either PPP or DNS Probe do not return an expected value? What is the best option to use on a PPoE connection? How do I specify a DNS server or site to lookup? How do you configure frequency of DNS probe like with PPP options? What would be shown in then logs if the restart functionality had kicked in? Does the router reboot at any point or is it just an interface restart.

As you can tell I have lots of questions but there does not appear to be much info on what the functionality actually does and how to utilise it.

Thanks for any insight you can provide
Hi. I can't answer your questions, but I will describe my experience. I occasionally have a connection failure about once a week and since then I have been completely satisfied with CHKWAN. After a connection failure, the connection is restored within 5 minutes. The script first restarts the wan interface and later the router if restarting the wan does not help. That is, if I'm not mistaken. Maximum satisfaction!!!
 
Hi. I can't answer your questions, but I will describe my experience. I occasionally have a connection failure about once a week and since then I have been completely satisfied with CHKWAN. After a connection failure, the connection is restored within 5 minutes. The script first restarts the wan interface and later the router if restarting the wan does not help. That is, if I'm not mistaken. Maximum satisfaction!!!
Thank you for your response.

I think as there has been no answers to my questions setting up ChkWAN is the direction I am leaning. Internet detection is enabled now on my router as a DNS probe, not sure how it will recover if at all, but having 2 methods to check cannot be a bad thing.

My head is a little lost though on how I can setup the script to run on cron so that it attempts to restart the WAN say 2 times, and on the 3 attempt reboot the router if there is still no connection.

Do I need 2 cron jobs?
 
My head is a little lost though on how I can setup the script to run on cron so that it attempts to restart the WAN say 2 times, and on the 3 attempt reboot the router if there is still no connection.

Do I need 2 cron jobs?
Yes, two cron jobs would be required to very crudely almost achieve your configuration i.e. see this 2018 post where (in most cases) four restarts are attempted then a reboot on the fifth.

The script itself does not keep track of the checks, so clearly if the router was booted say @9mins past the hour or @24mins past the hour etc., then a reboot could actually be enforced at the first check!
 
Last edited:
Yes, two cron jobs would be required to very crudely almost achieve your configuration i.e. see this 2018 post where (in most cases) four restarts are attempted then a reboot on the fifth.

The script itself does not keep track of the checks, so clearly if the router was booted say @9mins past the hour or @24mins past the hour etc., then a reboot could actually be enforced at the first check!
Thanks for your quick reply, I'm hoping you can help me debug an issue as the script is starting on reboot of the router as I can see the entries in the syslog, however it seems to have ignored by parameters. i.e custom ping location and nowait are ignored when the script runs every 10 mins

I've used the GitHub instructions to create and add a script to the wan-event file.

I have this listed in the wan-event file

#!/bin/sh

if [ "$2" == "connected" ];then
# sleep 5
# No need for recommended 'sleep n' as ChkWAN.sh has default 10 secs delay
# Check WAN connectivity every 5 minutes
sh /jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9,8.8.8.8 wan nowait cron="\*/10 \* \* \* \*" &
fi

Do you know why the parameters are being ignored?
 
I have this listed in the wan-event file

#!/bin/sh

if [ "$2" == "connected" ];then
# sleep 5
# No need for recommended 'sleep n' as ChkWAN.sh has default 10 secs delay
# Check WAN connectivity every 5 minutes
sh /jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9,8.8.8.8 wan nowait cron="\*/10 \* \* \* \*" &
fi

Do you know why the parameters are being ignored?
For FULL contol you need to manage the cron jobs manually.... the cron= directive only uses default args.

i.e. Try

Code:
#!/bin/sh

if [ "$2" == "connected" ];then
   # sleep 5
   # No need for recommended 'sleep n' as ChkWAN.sh has default 10 secs delay
   # Check WAN connectivity every 10 minutes
   #sh /jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9,8.8.8.8 wan nowait cron="\*/10 \* \* \* \*" &

   cru a "CheckMyWAN" "*/10 * * * *"  "/jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9,8.8.8.8 wan nowait"
fi
 
For FULL contol you need to manage the cron jobs manually.... the cron= directive only uses default args.

i.e. Try

Code:
#!/bin/sh

if [ "$2" == "connected" ];then
   # sleep 5
   # No need for recommended 'sleep n' as ChkWAN.sh has default 10 secs delay
   # Check WAN connectivity every 10 minutes
   #sh /jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9,8.8.8.8 wan nowait cron="\*/10 \* \* \* \*" &

   cru a "CheckMyWAN" "*/10 * * * *"  "/jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9,8.8.8.8 wan nowait"
fi
Excellent.

I made the changes above as well as adding a 2nd line for Reboots

cru a "Reboot_WAN" "29,59 * * * *" "/jffs/scripts/ChkWAN.sh ping=94.140.14.14,1.1.1.1,9.9.9.9 reboot nowait"

All seems to be running as expected.

Thank you so much for your help @Martineau.

When my router now gets a stuck WAN connection it will be interesting to see if the Router firmware gets there first in terms of restarting the WAN now that Internet Detection is now also enabled or your script. I feel very belts and braces covered; I now just need to wait for an event to happen
 
Hi,

Just posting back here with a success story and to report back on the 'firmware' auto reconnect for WAN.

I had a disconnect event just after midnight last night. The router did not recover itself like alluded to in the thread I referenced earlier (despite now having internet detection setup in the UI).

However once the ChkWAN script did its next check, it noticed the connection down across my 3 targets, tried them 3 times and then restarted the WAN interface, all back up and running within 10 minutes in total (the majority of that time was because the WAN failed just after one of my checks that was successful (approx 2 minutes after). The script itself once it knew the interface was down took 90 seconds to action after 3 retry attempt.

I am going to tweak the schedule slightly, so that the WAN check restart runs 8 times an hour, and only have 1 reboot at the top of the hour, should suffice for when I am away. If I or someone else is around and the WAN restart does not work we can pull the power manually.

Wanted to close the thread as solved in case others have a similar query.

Thanks
 

Similar threads

Sign Up For SNBForums Daily Digest

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