Wireless Client Mode as failover for WAN

Hi all,

I want to configure openwrt in a way that I want to have failover connection via WIFI (working as client) when there is no cable attached to WAN port (or internet is not available).

As for now I have:

  1. Laptop is connected to router
  2. Router is connected to WiFi network as a client. Laptop has access to internet using wifi network external IP
  3. Router WAN is then connected to another router's (router 2) LAN. Laptop has access to internet using router 2 network external IP
  4. Router WAN is disconnected. Laptop has no access to internet.
  5. To fix 4 I need to restart the router.
    What might be the issue for not switching to WiFi network?

I need the following to work:
Primary connection WAN.
In case of WAN being down use WiFi Client Network
WAN is back use it again.

If you set up both wireless networks as WAN, you should be able to use mwan3 for fail over automation



config wifi-iface 'my_wwan'
        option network 'wwan'
        option ssid 'my_SSID'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'sta'
        option key 'my_SSID_Key'


config interface 'wwan'
        option proto 'dhcp'
        option dns ''
        option metric '40'


config zone
        option name 'wan'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        option network 'wan wan2 wan3 wwan'
        option input 'DROP'


config interface 'wwan'
        option enabled '1'
        list track_ip ''
        list track_ip ''
        option reliability '1'
        option count '1'
        option timeout '2'
        option interval '5'
        option down '8'
        option up '3'
        option initial_state 'online'
        option family 'ipv4'
        option track_method 'ping'
        option size '56'
        option check_quality '0'
        option failure_interval '5'
        option recovery_interval '5'
        option flush_conntrack 'never'

config member 'wwan_m4_w1'
        option interface 'wwan'
        option metric '4'
        option weight '1'

config policy 'wan_2_3_w'
        list use_member 'wan_m1_w3'
        list use_member 'wan2_m2_w2'
        list use_member 'wan3_m3_w1'
        list use_member 'wwan_m4_w1'
        list last_resort 'unreachable'

config rule 'default_rule'
        option dest_ip ''
        option proto 'all'
        option sticky '0'
        option use_policy 'wan_2_3_w'

@frollic @codemarauder thank you guys, I will test tonight and will get back with some results.

Works perfectly. I just changed policy also for https & ipv6

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.