Code: Select all
/ip address
add address=192.168.1.2/24 interface=ether3 network=192.168.1.0
/ip dhcp-client
add add-default-route=no disabled=no interface=WAN1
add add-default-route=no disabled=no interface=WAN2
/ip dhcp-server network
add address=192.168.1.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.1.2
/ip firewall address-list
add address=192.168.1.3-192.168.1.254 list=LAN_USERS
add address=WAN1_SUBNET/24 list=WAN_SUBNET
add address=WAN2_SUBNET/24 list=WAN_SUBNET
/ip firewall nat
add action=masquerade chain=srcnat src-address-list=LAN_USERS
/ip firewall mangle
add action=accept chain=prerouting dst-address-list=WAN_SUBNET
add action=mark-routing chain=prerouting new-routing-mark=TO_WAN1 \
passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 \
src-address-list=LAN_USERS src-address-type=!local
add action=mark-routing chain=prerouting new-routing-mark=TO_WAN2 \
passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 \
src-address-list=LAN_USERS src-address-type=!local
/ip route
add check-gateway=ping distance=1 gateway=WAN1_IP routing-mark=TO_WAN1
add distance=1 gateway=WAN1_IP routing-mark=TO_WAN1
add check-gateway=ping distance=1 gateway=WAN2_IP routing-mark=TO_WAN2
add distance=1 gateway=WAN2_IP routing-mark=TO_WAN2
add check-gateway=ping distance=1 gateway=WAN1_IP
add distance=1 gateway=WAN2_IP
add check-gateway=ping distance=2 gateway=WAN2_IP
add distance=2 gateway=WAN1_IP
Code: Select all
/interface bridge
add name=bridge1
/interface bridge port
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether5
/ip address
add address=192.168.1.2/24 interface=bridge1 network=192.168.1.0