You are on page 1of 3

BALANCEAR MICROTIK

1. Asignando IP's a las interfaces de red

/ip address
add address=192.168.0.2/24 interface=ether3
add address=192.168.5.1/24 interface=ether5
2. Configurando enmascarado de las interfaces de red WAN

/ip firewall nat


add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade

add chain=srcnat out-interface=ether3 action=masquerade

3. Configurando las rutas, parte 1

/ip route
add gateway=pppoe-out1 distance=1
add gateway=pppoe-out1 distance=2

add gateway=192.168.0.1 check-gateway=ping distance=3

4. Configurando mangle, empieza la magia o los problemas para el que no


pone atencin
4.1 Primera parte, todo lo que entre por un WAN, debe salir por el mismo
WAN.
/ip firewall mangle
add chain=prerouting in-interface=pppoe-out1 connection-state=new new-connection-
mark=pppoe-out1_conn action=mark-connection passthrough=yes

add chain=prerouting in-interface=pppoe-out2 connection-state=new new-connection-


mark=pppoe-out2_conn action=mark-connection passthrough=yes

add chain=prerouting in-interface=ether3 connection-state=new new-connection-


mark=ether3_conn action=mark-connection passthrough=yes

add chain=output connection-mark=pppoe-out1_conn new-routing-mark=to_pppoe-out1


action=mark-routing passthrough=yes

add chain=output connection-mark=pppoe-out2_conn new-routing-mark=to_pppoe-out2


action=mark-routing passthrough=yes

add chain=output connection-mark=ether3_conn new-routing-mark=to_ether3 action=mark-


routing passthrough=yes

4.2 Segunda parte, dividiendo las conexiones de los clientes y formando


grupos.
/ip firewall mangle
add chain=prerouting in-interface=ether5 connection-state=new dst-address-type=!local per-
connection-classifier=both-addresses:3/0 action=mark-connection new-connection-mark=pppoe-
out1_conn passthrough=yes

add chain=prerouting in-interface=ether5 connection-state=new dst-address-type=!local per-


connection-classifier=both-addresses:3/1 action=mark-connection new-connection-mark=pppoe-
out2_conn passthrough=yes

add chain=prerouting in-interface=ether5 connection-state=new dst-address-type=!local per-


connection-classifier=both-addresses:3/2 action=mark-connection new-connection-
mark=ether3_conn passthrough=yes

add chain=prerouting in-interface=ether5 connection-mark=pppoe-out1_conn action=mark-


routing new-routing-mark=to_pppoe-out1 passthrough=yes

add chain=prerouting in-interface=ether5 connection-mark=pppoe-out2_conn action=mark-


routing new-routing-mark=to_pppoe-out2 passthrough=yes

add chain=prerouting in-interface=ether5 connection-mark=ether3_conn action=mark-routing


new-routing-mark=to_ether3 passthrough=yes

4.3 [Opcional] Tercera parte, accediendo a nuestros routers desde la red


balanceada
/ip firewall mangle
add chain=prerouting dst-address=192.168.0.0/24 action=accept in-interface=ether5
5. Configurando las rutas, parte 2
/ip route
add gateway=pppoe-out1 routing-mark=to_pppoe-out1
add gateway=pppoe-out2 routing-mark=to_pppoe-out2
add gateway=192.168.0.1 routing-mark=to_ether3 check-gateway=ping

You might also like