failover 2 wan 2 eth

I have 2 gateways on wan1 and wan2 and I created a simple failover. How to create failover 2 wan and 2 eth?
If wan1 runs eth1 goes through wan1, and if wan2 runs eth2 goes through wan2. If wan1 fail eth2 goes through wan2 and if wan2 fail eth2 goes through wan1.

Depends on how you need to detect failure. If the interface goes down reliably on failure you can just have floating static routes that kick in.

something like

/ip route
add routing-mark=wan1 gateway=<wan1-ip> check-gateway=ping
add routing-mark=wan2 gateway=<wan2-ip> check-gateway=ping
add gateway=<wan1-ip> check-gateway=ping
add gateway=<wan2-ip> check-gateway=ping
/ip route rule
add interface=ether1 action=lookup table=wan1
add interface=ether2 action=lookup table=wan2

Hello, but what should I enter if i would like to use two WANs not simultanously, but only when second will fail?
I’ve one WAN with static IP and second with dynamic IP (from USB modem and PPP client). So I need only WAN1 (WAN2 when WAN1 will fail - probably I need script to check if WAN1 is OK and when WAN1 will be back OK, it will close WAN2 and run WAN1, but still will be monitoring state of WAN1). Could You help me? Best regards.

/ip route
add gateway=<wan1-ip> check-gateway=ping
add gateway=<wan2-ip> check-gateway=ping distance=10

also, look at http://wiki.mikrotik.com/wiki/Advanced_Routing_Failover_without_Scripting

Hello, thank You for answer. But problem is with second WAN (because it’s 3G Modem it don’t have static gateway and IP - all is dynamic). Second when I run WAN2 Client it automatically change DNS in “DNS Settings” and when I stop WAN2, my DNS settings don’t come back from WAN1 (which is static) and I’ve no internet (when I change DNS, everything is OK). Main problem for me is connecting static WAN1 with dynamic WAN2. I also would like to start WAN2 when WAN1 fail (otherwise I will pay for using WAN2, when it’s not necessary. I’ve written:

add gateway= check-gateway=ping
add gateway=ppp-out1 check-gateway=ping distance=10
but client (WAN2) don’t remeber 10 (always automatically distance 0 or 1)

second, when I’ve written:

add routing-mark=wan1 gateway= check-gateway=ping
add routing-mark=wan2 gateway=ppp-out1 check-gateway=ping
intenet don’t works (when I remóve routing-mark=wan1 or wan2, internet is come back - what should I add).
Sorry for troubles and best regards.

use some DNS that is available via any ISP (OpenDNS, for example)

you mean, dynamic route?.. disable ‘add-default-route’ at DHCP client

do you have rules that will mark your packets with those marks? =)