/ip address add address=192.168.1.2/24 network=192.168.1.1 interface=ether1 add address=192.168.2.2/24 network=192.168.2.1 interface=ether2 add address=192.168.5.1/24 interface=ether5 /ip firewall nat add chain=srcnat out-interface=ether1 action=masquerade add chain=srcnat out-interface=ether2 action=masquerade /ip firewall mangle add chain=prerouting in-interface=ether1 connection-state=new new-connection-mark=wan1_con action=mark-connection passthrough=yes add chain=prerouting in-interface=ether2 connection-state=new new-connection-mark=wan2_con action=mark-connection passthrough=yes add chain=output connection-mark=wan1_con new-routing-mark=to_wan1 action=mark-routing passthrough=yes add chain=output connection-mark=wan2_con new-routing-mark=to_wan2 action=mark-routing passthrough=yes add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=wan1_con passthrough=yes add chain=prerouting dst-address-type=!local in-interface=ether5 per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=wan2_con passthrough=yes add chain=prerouting connection-mark=wan1_con in-interface=ether5 action=mark-routing new-routing-mark=to_wan1 add chain=prerouting connection-mark=wan2_con in-interface=ether5 action=mark-routing new-routing-mark=to_wan2 /ip route add dst-address=0.0.0.0/0 gateway=8.8.8.8 scope=30 target-scope=30 routing-mark=to_wan1 check-gateway=ping add dst-address=0.0.0.0/0 gateway=8.8.4.4 scope=30 target-scope=30 routing-mark=to_wan2 check-gateway=ping add dst-address=8.8.8.8 gateway=192.168.1.1 distance=1 check-gateway=ping add dst-address=8.8.4.4 gateway=192.168.2.1 distance=2 check-gateway=ping add dst-address=0.0.0.0/0 gateway=8.8.8.8 distance=1 scope=30 target-scope=30 check-gateway=ping add dst-address=0.0.0.0/0 gateway=8.8.4.4 distance=2 scope=30 target-scope=30 check-gateway=ping