Tag Archives: wan

Mikrotik Dual Wan

# NAT -----------------
# Enmascarar cualquier tráfico saliente por las interfaces wan:
# ether1 = canal_primario
# ether2 = canal_secundario
# ether3 = canal_terciario


ip firewall nat add chain=src-nat out-interface=ether1 action masquerade
ip firewall nat add chain=src-nat out-interface=ether2 action masquerade
ip firewall nat add chain=src-nat out-interface=ether3 action masquerade

# MANGLE -------------

# Marco el tráfico entrante de la red lan 10.2.59.0/24 para utilizar el canal primario

ip firewall mangle add src-address=10.2.59.0/24 action=mark-routing new-routing-mark=canal_primario chain=prerouting

# Marco el tráfico entrante de la red lan 10.2.60.0/24 utilizar el canal secundario

ip firewall mangle add src-address=10.2.60.0/24 action=mark-routing new-routing-mark=canal_secundario chain=prerouting

# Marco el tráfico entrante de la red lan 10.2.61.0/24 para utilizar el canal terciario

ip firewall mangle add src-address=10.2.61.0/24 action=mark-routing new-routing-mark=canal_terciario chain=prerouting

# Marco el tráfico saliente del router Mktik hacia los proveedores de servicio (en este caso 3 wans)

ip firewall mangle add src-address=192.168.56.2 action=mark-routing new-routing-mark=canal_primario chain=output
ip firewall mangle add src-address=192.168.57.2 action=mark-routing new-routing-mark=canal_secundario chain=output
ip firewall mangle add src-address=192.168.58.2 action=mark-routing new-routing-mark=canal_terciario chain=output


# ROUTE ----------------
# Estas son las reglas de enrutamiento basadas en marcas

ip route add gateway=192.168.56.1 routing-mark=canal_primario
ip route add gateway=192.168.57.1 routing-mark=canal_secundario
ip route add gateway=192.168.58.1 routing-mark=canal_terciario
ip route rule add dst-address=0.0.0.0/0 routing-mark=canal_primario table=canal_primario action=lookup
ip route rule add dst-address=0.0.0.0/0 routing-mark=canal_secundario table=canal_secundario action=lookup
ip route rule add dst-address=0.0.0.0/0 routing-mark=canal_terciario table=canal_terciario action=lookup
Advertisements