Enabling dual WAN with failover configuration

Is it possible to create a dual wan config with a RJ45 SFP (copper) module? Which module was already tested?

I believe it’s impossible to use the WAN port and SFP at once. (wired to the same CPU line)

So maybe SFP + one of the “physically LAN” ports, but I’m not good person to advice about that.

You’re right, what I expected to do seems impossible, because once you connect any SFP module the WAN port will be disabled. Maybe the best alternative is to configure one of the LAN ports (LAN4?) and assign it as WAN port using one of available ethernet interfaces (eth0 or eth1).
The next challenge will be making them both work simultaneously or at least automatically switch if main connection is dropped.

For this to work you need to install and configure mwan3 package but that would only establish a failover configuration, not a loadbalancing or even teaming.

@ssdnvv, you’re right, but this is one step further. I’m still struggling to configure the second WAN interface in /etc/config/network.

According to the hardwarescheme you need to delete port lan4 from interface lan and add corresponding cpu port eth0 it to interface wan.
Interface sections for lan and wan in /etc/config/network should then look like

config interface 'lan'
	option ifname 'lan0 lan1 lan2 lan3'
	option type 'bridge'
	option proto 'static'
	option ipaddr ''
	option netmask ''
	option delegate '0'

config interface 'wan'
	option ifname 'eth0 eth2'
	option proto 'dhcp'

But if and how this works with mwan3 I don’t know - you cannot have different IP-adresses for one interface…

This doesn‘t work this way. You have to create a seperate Interface (call it WAN2 e.g.) in LuCi → Network → Interfaces, you most likely need to set it up as DHCP Client (depending on your WAN connection). Enable „Use default gateway“ in „Advanced Settings“. You can assign it to firewall zone WAN for simplicity, then you remove LAN4 from LAN bridge and ad it to the newly created Interface WAN2. You can control which WAN interface should be default by assigning a lower metric in its „Adcanced Settings“.

With this configuration you should have internet access with both or either one of the „WAN ethernet cables“ connected. If you remove one the corrosponding interface goes down and traffic goes through the other. Problem is that not all internet outtages lead to the interface going down. This is why you need to set up something like mwan3 that regularly checks both wan connections and changes routing table if an outage is detected.

This is impossible because eth0 is directly connected to omnias internal switch. You can‘t change that through configuration without soldering ;).

1 Like

Hi @protree and @ssdnvv , thanks for your help. I know it was supposed to be be simple to assign LAN4 as secondary WAN but, after following your instructions I unplugged the ethernet cable from primary WAN and connected to secondary WAN (WANB), with no results whatsoever.

Please check my /etc/config/network config (WANB config and also LAN interface after removing LAN4)

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option ipaddr ''
	option netmask ''
	option ip6assign '60'
	option bridge_empty '1'
	option ifname 'lan0 lan1 lan2 lan3'

config interface 'wanb'
	option ifname 'lan4'
	option proto 'dhcp'

config interface 'wanb6'
	option ifname '@wanb'
	option proto 'dhcpv6'
	option reqaddress 'try'
	option reqprefix 'auto'

Also, please check my /var/log/messages file, filtered with wanb interface events only

Feb 13 19:40:56 turris netifd: Network device 'lan4' link is up
Feb 13 19:40:56 turris netifd: Interface 'wanb' has link connectivity 
Feb 13 19:40:56 turris netifd: Interface 'wanb' is setting up now
Feb 13 16:40:56 turris kernel: [  884.425198] mv88e6085 f1072004.mdio-mii:10 lan4: Link is Up - 1Gbps/Full - flow control rx/tx
Feb 13 16:40:56 turris kernel: [  884.433792] IPv6: ADDRCONF(NETDEV_CHANGE): lan4: link becomes ready
Feb 13 19:40:56 turris netifd: wanb (15455): udhcpc: started, v1.30.1
Feb 13 19:40:56 turris netifd: wanb (15455): udhcpc: sending discover
Feb 13 19:40:59 turris netifd: wanb (15455): udhcpc: sending discover
Feb 13 19:41:02 turris netifd: wanb (15455): udhcpc: sending discover
Feb 13 19:41:19 turris odhcp6c[8630]: Failed to send DHCPV6 message to ff02::1:2 (Permission denied)

It is odd, but it looks like the connection is being activated but DHCP client is not working as expected, or any other reason.

What kind of WAN connection do you have (fiber/adsl/cable [Docsis])? The Mac address of the LAN Port differs from the WAN Port and some modems, especially cable modems, bind to the first MAC address they see when they start. So you may have to restart your modem for your test to work.

Apart from that the config snippet you provided looks good to me…

EDIT: Did you restart your network with /etc/init.d/network restart or reboot?

@protree, you made my day! Who could imagine that simply reseting my cable modem could lead to the desirable result! Thanks a lot!! :grin:

You‘re welcome :slight_smile:

Now is time to have some fun with mwan3 and trying to make it work with existing services (ddns, vpn, etc). But I believe it will be less challenging or tricky.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.