What's new

[beta] Dual WAN helper script (discontinued)

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

I have tested this on three routers, many times. Works without fail on all of them, even the router with the LTS fork.
Now i am on primary - only after it switched from secondary after 9*99 timeout. That means that script is in charge of this strange behavior. I hope tomorrow morning we will find out what is the problem )))
 
I'm working on the issues reported and have found a more reliable way to detect the WAN type in use.
As always, adding new features brings up more inconsistencies.
I noticed restarting the wan service is not really helpful in many cases, so I work on an even better way to force it.
These things take time to code and test, actually, testing takes the most time...
 
As always, adding new features brings up more inconsistencies.
Hi! Thanx for your update.
I will be on vacations for 3 weeks so will not be able to test new releases. I did some tests yesterday - and i am 1000% sure that the mechanism you are using in the script is breaking primary/secondary WAN detection. Or this mechanism is not reliable at all.
Because when i used email noification script - i didn't get a single false detection. And now i face even bigger problem. Router stops switching back to primary wan under certain conditions. Instead of changing primary wan status from "disconnected" to "standby" - wan0 always stays disconnected even after wan cable is plugged back. This means that router never switches back to primary wan - even if primary is online. I waited for more then hour - router was still on wan1.
It usually happends the second time router switches to secondary wan after reboot.
I reboot router, get Primary wan email report, then unplug wan. Router switches to secondary, sends correct email. Then i plug wan0 back. Wait for timeout - router switches back to primary, sends proper email.
And after this as soon as i unplug wan again - router switches to secondary, sends correct email but never swithces back to primary because it thinks that primary is disconnected (although it should be in standby mode). And after this router starts thinking that it is constantly on secondary. Even if i reboot it or make powercycle - it still sends that it is on secondary although it is on primary.
Yesterday i left the router thinking that it is on secondary (in reality it is on primary) and today - after almost 22 hours router sent me an email that it switched to primary. But nothing changed in reality - router is on primary.
 
Hi! Thanx for your update.
I will be on vacations for 3 weeks so will not be able to test new releases. I did some tests yesterday - and i am 1000% sure that the mechanism you are using in the script is breaking primary/secondary WAN detection. Or this mechanism is not reliable at all.
Because when i used email noification script - i didn't get a single false detection. And now i face even bigger problem. Router stops switching back to primary wan under certain conditions. Instead of changing primary wan status from "disconnected" to "standby" - wan0 always stays disconnected even after wan cable is plugged back. This means that router never switches back to primary wan - even if primary is online. I waited for more then hour - router was still on wan1.
It usually happends the second time router switches to secondary wan after reboot.
I reboot router, get Primary wan email report, then unplug wan. Router switches to secondary, sends correct email. Then i plug wan0 back. Wait for timeout - router switches back to primary, sends proper email.
And after this as soon as i unplug wan again - router switches to secondary, sends correct email but never swithces back to primary because it thinks that primary is disconnected (although it should be in standby mode). And after this router starts thinking that it is constantly on secondary. Even if i reboot it or make powercycle - it still sends that it is on secondary although it is on primary.
Yesterday i left the router thinking that it is on secondary (in reality it is on primary) and today - after almost 22 hours router sent me an email that it switched to primary. But nothing changed in reality - router is on primary.
I have noticed this disconnected error too.
This happens even if I have no scripts running at all on the router. I fear this is an Asus error in the last release. But I'm sure I'll track it down.
 
I have noticed this disconnected error too.
It could be a great feature, not a bug - if it really tracked diconnected wan cable and didn't switch every time to wan0 untill cable is really connected. But it says disconnected even when cable is plugged back. Fckn assus.
 
It could be a great feature, not a bug - if it really tracked diconnected wan cable and didn't switch every time to wan0 untill cable is really connected. But it says disconnected even when cable is plugged back. Fckn assus.
I have sorted that case out already, but it needs a lot more testing and fine-tuning.
 
thank you @thelonelycoder for your work on this script

I recently came upon Dual WAN problem when Primary WAN is in DHCP mode (Automatic IP) and Vodafone Cable modem was not giving any IP (due to Vodafone network issues) so even Primary WAN is "connected" IP is 0.0.0.0 and Internet is not working
https://www.snbforums.com/threads/d...k-not-working-as-it-should.32581/#post-349960
this problem is very easy to replicate, if you connect some switch or computer to your primary WAN with no DHCP running, Primary WAN will get no IP (0.0.0.0) but is says "Connected" even there is no Internet
Asus dual-wan fail-over and watch-dog code is in pretty bad shape, because it will keep switching to secondary WAN and then go back to primary WAN (because of fall-back enabled) even though primary WAN has no Internet connection, you will enter a loop - primary wan (fail-over) to secondary wan (fall-back) to primary wan and so on... even though Internet is working fine on Secondary WAN router stays there very shortly (because Primary WAN is "connected") and from my computer ping-ing 8.8.8.8 you have huge packet loss

is there a way to manually change active WAN interface in fail-over mode, and/or command to temporarily disable fall-back?
https://www.snbforums.com/threads/dual-wan-manually-change-interface.38315/
lets say your ISP send you e-mail notification about upcoming service-interruptions due to work done on infrastructure in your area, so you can switch to Secondary WAN (3G /4G USB dongle)

if @RMelin knows the username of ASUS Engineer here on forum, we could inform them about this problem, since ASUS Support is not giving a damn on open tickets
I have laid them everything, with logs and screenshots, pretty obvious, and super-easy to replicate, still there are only no-brain responses: have you tried latest firmware and so on...
 
thank you @thelonelycoder for your work on this script

I recently came upon Dual WAN problem when Primary WAN is in DHCP mode (Automatic IP) and Vodafone Cable modem was not giving any IP (due to Vodafone network issues) so even Primary WAN is "connected" IP is 0.0.0.0 and Internet is not working
https://www.snbforums.com/threads/d...k-not-working-as-it-should.32581/#post-349960
this problem is very easy to replicate, if you connect some switch or computer to your primary WAN with no DHCP running, Primary WAN will get no IP (0.0.0.0) but is says "Connected" even there is no Internet
Asus dual-wan fail-over and watch-dog code is in pretty bad shape, because it will keep switching to secondary WAN and then go back to primary WAN (because of fall-back enabled) even though primary WAN has no Internet connection, you will enter a loop - primary wan (fail-over) to secondary wan (fall-back) to primary wan and so on... even though Internet is working fine on Secondary WAN router stays there very shortly (because Primary WAN is "connected") and from my computer ping-ing 8.8.8.8 you have huge packet loss

is there a way to manually change active WAN interface in fail-over mode, and/or command to temporarily disable fall-back?
https://www.snbforums.com/threads/dual-wan-manually-change-interface.38315/
lets say your ISP send you e-mail notification about upcoming service-interruptions due to work done on infrastructure in your area, so you can switch to Secondary WAN (3G /4G USB dongle)

if @RMelin knows the username of ASUS Engineer here on forum, we could inform them about this problem, since ASUS Support is not giving a damn on open tickets
I have laid them everything, with logs and screenshots, pretty obvious, and super-easy to replicate, still there are only no-brain responses: have you tried latest firmware and so on...
We can only hope that Asus has and will spend some time eliminating some or all of the bugs in dual WAN/Wanduck in the 382.x code base. I'm sure they are aware what a mess it is.
 
Last edited:
is there a way to manually change active WAN interface in fail-over mode, and/or command to temporarily disable fall-back?
https://www.snbforums.com/threads/dual-wan-manually-change-interface.38315/
lets say your ISP send you e-mail notification about upcoming service-interruptions due to work done on infrastructure in your area, so you can switch to Secondary WAN (3G /4G USB dongle)
Manually switching over a dual WAN with fail-back is tricky over the command line.
The underlying closed source code has a mind of its own.
I do have code to switch them successfully but I am uncomfortable to post it as it is a script hack with many unknown factors such as the type of the WAN connections (wired / USB Modem / dual wired LAN port no and so forth).

I'd love to spend more time on the dual-wan-helper script but I admit correcting errors in the Wanduck/dual WAN closed code with a shell script is kind of a battle I will never win. The behaviour is too unpredictable what Asus does vs what I expect it to do.
So I've given up on it for the moment and wait for the day that I can test AM382 on a device myself. That appears to be far into the future as Asus is not keen on selling the RT-AC86U in Switzerland.
 
Manually switching over a dual WAN with fail-back is tricky over the command line.
The underlying closed source code has a mind of its own.
I do have code to switch them successfully but I am uncomfortable to post it as it is a script hack with many unknown factors such as the type of the WAN connections (wired / USB Modem / dual wired LAN port no and so forth).

I'd love to spend more time on the dual-wan-helper script but I admit correcting errors in the Wanduck/dual WAN closed code with a shell script is kind of a battle I will never win. The behaviour is too unpredictable what Asus does vs what I expect it to do.
So I've given up on it for the moment and wait for the day that I can test AM382 on a device myself. That appears to be far into the future as Asus is not keen on selling the RT-AC86U in Switzerland.
So it means there will be no beta 4 you wrote about?
 
Hi Guys

Love this script!

I would like to request the following for this script, please.

Would it be possible to add the ability to disable a LAN port when the WAN is down, then bring that LAN port back online after the WAN IP is detected/up?

With Kind Regards
 
Hi Guys

Love this script!

I would like to request the following for this script, please.

Would it be possible to add the ability to disable a LAN port when the WAN is down, then bring that LAN port back online after the WAN IP is detected/up?

With Kind Regards
A standard LAN port, not the one used for dual-wan (if you use that)?
 
A standard LAN port, not the one used for dual-wan (if you use that)?

Hi theLonelycoder

A standard LAN port NOT used by dual-wan.

Basically what I am trying to achieve is, when the WAN goes down, I need a LAN port to be disabled, so the second gateway I am using (connected to my AC5300), can see no WAN IP address is leased, and then it will automatically switch over to LTE.

Then, once the WAN IP has been established (by getting a valid public IP), then enable the disabled LAN port for my LTE internet. Thus, restoring the whole network back to cable, which includes my SIP account on cable. The LTE gateway will return to operating as intended.

Does this make sense?

With Kind Regards
 
Last edited:
Hi theLonelycoder

A standard LAN port NOT used by dual-wan.

Basically what I am trying to achieve is, when the WAN goes down, I need a LAN port to be disabled, so the second gateway I am using (connected to my AC5300), can see no WAN IP address is leased, and then it will automatically switch over to LTE.

Then, once the WAN IP has been established (by getting a valid public IP), then enable the disabled LAN port for my LTE internet. Thus, restoring the whole network back to cable, which includes my SIP account on cable. The LTE gateway will return to operating as intended.

Does this make sense?

With Kind Regards
I know of no way to physically disable the port when a cable is plugged in.

There is, however, a way to disable access to the LAN for specific ports by disabling it in robocfg.
You can try it manually. First you have to find the port with:
Code:
robocfg showports
It'll show all ports, the state and the mac address of the connected device.
If you want to bring down LAN port 2 and re-enable it, the commands are:
Code:
robocfg port 2 state disabled

robocfg port 2 state enabled
If this action triggers your second gateway to enable its WAN then we're getting close to a solution for your problem.
 
Last edited:
I know of no way to physically disable the port when a cable is plugged in.

There is, however, a way to disable access to the LAN for specific ports by disabling it in robocfg.
You can try it manually. First you have to find the port with:
Code:
robocfg showports
It'll show all ports, the state and the mac address of the connected device.
If you want to bring down LAN port 2 and re-enable it, the commands are:
Code:
robocfg port 2 state disabled

robocfg port 2 state enabled
If this action triggers your second gateway to enable its WAN then we're getting close to a solution for your problem.
Thanks for this.

I am sure I can figure out how to write up a script to do this somehow.

With Kind Regards
 
Hello!

I use the Asus RT-N16 router with the firmware 380.65.9_HGG-FINAL (based on RMerlin 380.65_4 + ASUS 380.4180 GPL code) from Hugo Gomes.

dual-wan-helper_v1.0-beta3
1. With the help of WinSCP I copied the script dual-wan-helper into the folder /jffs/scripts/ .
2. I opened the terminal and entered the line chmod a+rx /jffs/scripts/* , but there was no response.
3. I did not understand this point at all:
# 4. Place a file link in /jffs/scripts/wan-start to start it when the WAN state changes.
# Open wan-start and place the following line in the file at the bottom, without the leading #
# but leave the comment part in (# WAN ...):
# /jffs/scripts/dual-wan-helper # Dual WAN helper

Please write, this script will work if the primary provider is in the WAN, and the secondary provider is in LAN4?
What settings in the router need to be done?
How do I know if the script works or not?
 

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