dual wan load balancing with fail over

/ip address
add address=192.168.0.2 interface=pos_lan ##ether3
add address=192.168.1.2 interface=local_lan ##ether4
add address=xx.xx.xx.102/30 interface=WAN1##ether1
add address=xx.xx.xx.123/29 interface=WAN2##ether2

/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

add chain=prerouting dst-address=xx.xx.xx.102/30 action=accept in-interface=pos_lan
add chain=prerouting dst-address=xx.xx.xx.123/29 action=accept in-interface=local_lan
add chain=prerouting dst-address=xx.xx.xx.102/30 action=accept in-interface=pos_lan
add chain=prerouting dst-address=xx.xx.xx.123/29 action=accept in-interface=local_lan

add chain=prerouting dst-address-type=!local in-interface=pos_lan per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=local_lan per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=pos_lan per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=local_lan per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

add chain=prerouting connection-mark=WAN1_conn in-interface=pos_lan action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=local_lan action=mark-routing new-routing-mark=to_WAN2
add chain=prerouting connection-mark=WAN1_conn in-interface=pos_lan action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=local_lan action=mark-routing new-routing-mark=to_WAN2

/ip route
add dst-address=0.0.0.0/0 gateway=xx.xx.xx.101 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=xx.xx.xx.121 routing-mark=to_WAN2 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=xx.xx.xx.101 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=xx.xx.xx.121 distance=2 check-gateway=ping


/ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade



can any one help me with this configuration. I want to implement it on my CCR series router.

i suggest you to do not change ether or wlan name completly but leave like ether1-WAN1, ether2-WAN2 etc.

now I read the script…

You can search on the forum and on the wiki, but real and full load balancing between two wan from different ISP is really hard to obtain, because all solution used really do not balance anything at the end, because all the time the TCP problem is always present: the other side expect the same IP as source for packet and reply at the same IP…

Thank you for your opinion.
Then Can you give any configuration which will working as failover, and both of my lan will get internet without any problem.