SmallNetBuilder Forums

Go Back   SmallNetBuilder Forums > Wireless Networking > ASUS Wireless > Asuswrt-Merlin

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-30-2012, 07:40 AM
Nerre Nerre is offline
Senior Member
 
Join Date: Oct 2012
Posts: 159
Thanks: 0
Thanked 18 Times in 16 Posts
Nerre is just starting out
Default Possible improvements to dual WAN fail-over function

I will probably not have need for it now when I have fiber, but I though it might be an idea to start a topic about it to see how people would like to behave.

I have tried it with a 3G modem as secondary (fail-over) WAN connection and noted a few disappointing issues (and I tried to browse the source to see how things worked, but I'm not a programmer so I might have missed some points).


The primary issue is that fail-over seems to only switch WAN when the currently used WAN goes down. But I think most users would want to use the primary WAN whenever it is up, and only use the secondary when primary is down (because the secondary probably is slower, more expensive and/or might have traffic limits).

This means that the primary WAN connection would have to be regularly "probed" to find out when it goes up again. And this connects to the next issue.


A second issue is that the way the router detects WAN down seems to rely on the ethernet link status. Often the ethernet link is up but there is failed connection somewhere on the way to the internet (providers router down or something like that). So, there would be a need for a possibility to configure some kind of active probes (for example pinging an external host or pulling a page using wget or similar) to be able to assess the internet connection rather than the WAN ethernet link.


A third issue is that QoS probably would have to be set up with different max rates for the secondary WAN. If the secondary WAN has traffic limits maybe some traffic would have to be blocked too (for example if your 3G has limits like 5GB a month you wouldn't want your bittorrent client using up that traffic).



I was thinking about the best ways to solve these issues.

The first one does probably need some patching, but I think a clever patching (for example to support semaphore files in addition to the current logic) could make the other issues possible to solve using scripts.

For example the code could be written so when a file called wan_down is created it will switch to secondary WAN. When the wan_down sempahore disappear the router switches back to primary. (There might be some race conditions that have to be handled.)

That way "power users" could craft their own scripts for the probing, when the script detects that the primary WAN is down it creates the semaphore and keeps probing. When it detects that primary WAN is up again it just removes the semaphore.

The QoS configuration as well as changed iptables rules could probably be changed using scripts like the Merlin jffs features. A few if-statements in the scripts could be used to select different parts depending on what WAN interface is used (not sure if it currently is possible from a script to detect which interface is used, but I guess that it would be easy to solve using semaphore files too).
Reply With Quote
  #2  
Old 11-30-2012, 09:56 AM
RMerlin's Avatar
RMerlin RMerlin is offline
Very Senior Member
 
Join Date: Apr 2012
Location: Canada
Posts: 3,878
Thanks: 27
Thanked 1,671 Times in 814 Posts
RMerlin is just starting out
Default

Dual WAN is an experimental and unfinished feature that Asus are still developing. Until they finalize it, it would be pointless for me to make any code change to it, as they might very well rewrite part of it in any future update.
__________________
Asuswrt-Merlin: Customized firmware for Asus routers
Github: github.com/RMerl - Twitter: RMerlinDev
See the sticky post for more info.
Reply With Quote
  #3  
Old 11-30-2012, 01:00 PM
Nerre Nerre is offline
Senior Member
 
Join Date: Oct 2012
Posts: 159
Thanks: 0
Thanked 18 Times in 16 Posts
Nerre is just starting out
Default

But my suggested patch would probably be less than 10 lines of code, the rest would be handled by scripts.
Reply With Quote
  #4  
Old 11-30-2012, 01:31 PM
RMerlin's Avatar
RMerlin RMerlin is offline
Very Senior Member
 
Join Date: Apr 2012
Location: Canada
Posts: 3,878
Thanks: 27
Thanked 1,671 Times in 814 Posts
RMerlin is just starting out
Default

Quote:
Originally Posted by Nerre View Post
But my suggested patch would probably be less than 10 lines of code, the rest would be handled by scripts.
It's not that simple. The Dual WAN code is spread all over the firmware. Taking one interface down and bringing another one up isn't straightforward (you have to take into account all the different WAN interfaces supported), and you also have to make sure not to run into any conflict with the existing code that takes care of checking the link states - your method suggests overriding them.

If someone feels like doing it and is able to provide a patch, I'd be happy to review the patch and possibly merge it in. But developing this amounts to at least a couple of hours of work (not including tests), not just a 30 mins patch.

Personally, I'd rather wait for Asus to finish this code. The failover recovery is only one thing that does not work yet - the webui itself is also broken and would require a few additional hours to complete and to debug.
__________________
Asuswrt-Merlin: Customized firmware for Asus routers
Github: github.com/RMerl - Twitter: RMerlinDev
See the sticky post for more info.
Reply With Quote
  #5  
Old 12-01-2012, 02:15 AM
Nerre Nerre is offline
Senior Member
 
Join Date: Oct 2012
Posts: 159
Thanks: 0
Thanked 18 Times in 16 Posts
Nerre is just starting out
Default

This topic was not intended as a request, it was intended to discuss what could be done. So don't feel any pressure to any work at all, people interested in the changes can always check out the source and make their own build

The discussion could also be input for Asus development.
Reply With Quote
  #6  
Old 12-01-2012, 12:58 PM
RMerlin's Avatar
RMerlin RMerlin is offline
Very Senior Member
 
Join Date: Apr 2012
Location: Canada
Posts: 3,878
Thanks: 27
Thanked 1,671 Times in 814 Posts
RMerlin is just starting out
Default

Quote:
Originally Posted by Nerre View Post
This topic was not intended as a request, it was intended to discuss what could be done. So don't feel any pressure to any work at all, people interested in the changes can always check out the source and make their own build

The discussion could also be input for Asus development.
No problem. Just giving my side of things on this.

And the more people post about Dual WAN, the more Asus might feel it's worth spending more efforts on finalizing and polishing it I think a properly working Dual WAN could be a killer feature that would sell routers on its own.
__________________
Asuswrt-Merlin: Customized firmware for Asus routers
Github: github.com/RMerl - Twitter: RMerlinDev
See the sticky post for more info.
Reply With Quote
  #7  
Old 12-01-2012, 01:14 PM
Nerre Nerre is offline
Senior Member
 
Join Date: Oct 2012
Posts: 159
Thanks: 0
Thanked 18 Times in 16 Posts
Nerre is just starting out
Default

Yes, I know a lot of people who have so much problems with their ADSL that they are thinking about switching completely to 3G/4G (I was one of them until two days ago, our ADSL went down for 30-90 seconds every five-ten minutes when it was raining...). A working dual WAN fail-over would probably be worth a lot to them.

I was trying to find the place in the source where the switching took place but didn't find it now, maybe that part has been changed in the last release. What I remember was a couple of if-statments over a piece of code half a screen long.

It was something like (just pseudo code here): if (status=disconnected && dual_wan=failover) switch to other WAN

Everything using other functions so in that part there was nothing that was different depending on whether the second WAN was USB-connected or LAN1.

But I'm not even sure in what file I found it, maybe it wasn't wan.c.
Reply With Quote
  #8  
Old 01-04-2013, 09:04 PM
jazzguy jazzguy is offline
New Member
 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jazzguy is just starting out
Default How dual wan is done in dd-wrt

Sorry if this is a bit basic, but here is the approach taken for dual-wan in DD-WRT:

http://www.dd-wrt.com/wiki/index.php..._with_failover

It seems that one of the easiest ways to test for a failed WAN connection would be to query that WAN link's DNS servers. I've seen it implemented on a heartbeat approach, trying a DNS query to each WAN every minute, or alternatively when a DNS query fails, the alternative WAN's DNSes are queried and the one that responds is regarded as live. To switch back to primary, one could continue to do every DNS query to both WAN links every time an external DNS query is done, and when primary responds, it's regarded as live.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 12:32 PM.

Top 10 Stats
Top Posters* Top Thanked
RMerlin  242
stevech  69
coxhaus  62
kfmfe04  32
CaptainSTX  32
Pericynthion  30
sm00thpapa  30
jlake  29
RogerSC  23
TonyH  22
RMerlin  1671
stevech  146
ryzhov_al  117
TeHashX  88
RogerSC  72
GregN  54
Geraner  44
CL-Jeremy  42
joegreat  41
sfx2000  34
Most Viewed Threads* Hottest Threads*
Old Asus .370...  9924
Old Rt-ac68u  5367
Old Apple's New...  4398
Old Teaser-time!  3050
Old New firmware  2260
Old Upgrade to...  2163
Old Site Survey...  2100
Old 5Ghz Speed...  1813
Old Download...  1631
Old My Cloud...  1414
Old Site Survey...  46
Old Asus .370...  44
Old Apple's New...  38
Old Rt-ac68u  34
Old Teaser-time!  23
Old 5Ghz Speed...  21
Old Upgrade to...  21
Old New N66U -...  15
Old Best...  15
Old unable to...  14





Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
© 2006-2013 Pudai LLC All Rights Reserved.