You are on page 1of 2

#Asignar IP a cada interface

/ip address
add address=10.0.1.2/24 interface=WAN1
add address=10.0.2.2/24 interface=WAN2
add address=10.0.3.2/24 interface=WAN3
add address=10.0.4.2/24 interface=WAN4
add address=192.168.100.1/24 interface=LAN
#Configurar que cada WAN despache internet
/ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade
add chain=srcnat out-interface=WAN3 action=masquerade
add chain=srcnat out-interface=WAN4 action=masquerade
#Asignar los respectivos gateway de cada WAN
/ip route
add gateway=10.0.1.1 check-gateway=ping distance=1
add gateway=10.0.2.1 check-gateway=ping distance=2
add gateway=10.0.3.1 check-gateway=ping distance=3
add gateway=10.0.4.1 check-gateway=ping distance=4
#Configuracion para que todo lo que entre por una WAN, salga por la misma WAN
/ip firewall mangle
add chain=prerouting in-interface=WAN1 connection-state=new new-connection-mark=
WAN1_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=WAN2 connection-state=new new-connection-mark=
WAN2_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=WAN3 connection-state=new new-connection-mark=
WAN3_conn action=mark-connection passthrough=yes
add chain=prerouting in-interface=WAN4 connection-state=new new-connection-mark=
WAN4_conn action=mark-connection passthrough=yes
add chain=output connection-mark=WAN1_conn
routing passthrough=yes
add chain=output connection-mark=WAN2_conn
routing passthrough=yes
add chain=output connection-mark=WAN3_conn
routing passthrough=yes
add chain=output connection-mark=WAN4_conn
routing passthrough=yes

new-routing-mark=to_WAN1 action=marknew-routing-mark=to_WAN2 action=marknew-routing-mark=to_WAN3 action=marknew-routing-mark=to_WAN4 action=mark-

#Division de las conexiones de los clientes y formando grupos, both-addresses:4/


0 ya que existen 4 wan si son 3 deberia ser both-addresses:3/0 y asi sucesivamen
te
/ip firewall mangle
#Parte A
add chain=prerouting in-interface=LAN connection-state=new dst-address-type=!loc
al per-connection-classifier=both-addresses:4/0 action=mark-connection new-conne
ction-mark=WAN1_conn passthrough=yes
add chain=prerouting in-interface=LAN connection-state=new dst-address-type=!loc
al per-connection-classifier=both-addresses:4/1 action=mark-connection new-conne
ction-mark=WAN2_conn passthrough=yes
add chain=prerouting in-interface=LAN connection-state=new dst-address-type=!loc
al per-connection-classifier=both-addresses:4/2 action=mark-connection new-conne
ction-mark=WAN3_conn passthrough=yes
add chain=prerouting in-interface=LAN connection-state=new dst-address-type=!loc
al per-connection-classifier=both-addresses:4/3 action=mark-connection new-conne
ction-mark=WAN4_conn passthrough=yes

#Parte B
add chain=prerouting in-interface=LAN connection-mark=WAN1_conn
ing new-routing-mark=to_WAN1 passthrough=yes
add chain=prerouting in-interface=LAN connection-mark=WAN2_conn
ing new-routing-mark=to_WAN2 passthrough=yes
add chain=prerouting in-interface=LAN connection-mark=WAN3_conn
ing new-routing-mark=to_WAN3 passthrough=yes
add chain=prerouting in-interface=LAN connection-mark=WAN4_conn
ing new-routing-mark=to_WAN4 passthrough=yes
#Configuracion de rutas
/ip route
add gateway=10.0.1.1 routing-mark=to_WAN1
add gateway=10.0.2.1 routing-mark=to_WAN2
add gateway=10.0.1.1 routing-mark=to_WAN3
add gateway=10.0.2.1 routing-mark=to_WAN4

check-gateway=ping
check-gateway=ping
check-gateway=ping
check-gateway=ping

action=mark-rout
action=mark-rout
action=mark-rout
action=mark-rout