PDA

Ver la versión completa : [Balanceo de Carga - Mikrotik] PCC de 2, 3, 4 o mas lineas de Internet [Load Balancing]



mikrotikperu
29/09/2013, 19:07
Para este caso presentamos balanceo de 4 lineas
Podemos tener una breve explicacion (http://inkalinux.com/foros/showthread.php?89-Balanceo-PCC) para este caso nuestra puerta de enlace para las maquinas seria 10.0.0.1


/ ip address
add address=10.0.0.1/24 network=10.0.0.0 broadcast=10.0.0.255 interface=ether5

/ ip firewall mangle
add chain=prerouting in-interface=pppoe-out1 connection-mark=no-mark action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=pppoe-out2 connection-mark=no-mark action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting in-interface=pppoe-out3 connection-mark=no-mark action=mark-connection new-connection-mark=ISP3_conn
add chain=prerouting in-interface=pppoe-out4 connection-mark=no-mark action=mark-connection new-connection-mark=ISP4_conn

add chain=prerouting in-interface=ether5 connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:4/0 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ether5 connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:4/1 action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting in-interface=ether5 connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:4/2 action=mark-connection new-connection-mark=ISP3_conn
add chain=prerouting in-interface=ether5 connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:4/3 action=mark-connection new-connection-mark=ISP4_conn

add chain=prerouting connection-mark=ISP1_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ISP2
add chain=prerouting connection-mark=ISP3_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ISP3
add chain=prerouting connection-mark=ISP4_conn in-interface=ether5 action=mark-routing new-routing-mark=to_ISP4

add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2
add chain=output connection-mark=ISP3_conn action=mark-routing new-routing-mark=to_ISP3
add chain=output connection-mark=ISP4_conn action=mark-routing new-routing-mark=to_ISP4

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out2 routing-mark=to_ISP2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out3 routing-mark=to_ISP3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out4 routing-mark=to_ISP4 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out2 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out3 distance=3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out3 distance=4 check-gateway=ping

/ 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=pppoe-out3 action=masquerade
add chain=srcnat out-interface=pppoe-out4 action=masquerade

evans_1981
03/02/2014, 16:27
En esta parte del codigo no se si nos puedes explicar amigo Mikrotikperu que es lo que hace dst-address-type=!local y per-connection-classifier=both-addresses:4/3 ya savemos que en per-connectin -clssifier ay varias opciones para escoger y en que entorno nos valdria cada una esas opciones

mikrotikperu
03/02/2014, 20:33
Buena pregunta
La respuesta es sencilla,
per-connection-classifier=both-addresses:4/3 = decir que vas a balancear tanto como origen como destino las IPs y el 4/3 quiere decir que es la parte 3 de una torta de 4 tajadas ;) mas sencillo ni en inkalinux :D

Saludos,