Balanceo de Carga Mikrotik para 4 Lineas [Script]

Publicado por D3M0N, 03 de Agosto de 2013, 08:52:43 PM

Tema anterior - Siguiente tema

0 Miembros y 2 Visitantes están viendo este tema.

D3M0N


NOTA: Debes respetar todos los vares aclarados en este post, de lo contrario pueda que no funcione.

1.- Puedes utilizar cualquier Mirkotik que tenga al menos 5 bocas, te recomiendo el RB450G, RB750, etc. Recuerda que te recomendamos tener una v5.25 de RouterOS.

2.- Realice un Reset-Configuration a su equipamiento, al reiniciar elimine el script de configuración por defecto.

3.- Ahora debemos configurar los Modem/Routers que tengamos, en este caso tendriamos 4 de la siguiente manera:

Ether1-WAN - Gateway: 192.168.1.254 - DHCP: 192.168.1.1-192.168.1.2
Ether2-WAN - Gateway: 192.168.2.254 - DHCP: 192.168.1.1-192.168.1.2
Ether3-WAN - Gateway: 192.168.3.254 - DHCP: 192.168.1.1-192.168.1.2
Ether4-WAN - Gateway: 192.168.4.254 - DHCP: 192.168.1.1-192.168.1.2

4.- Vamos a tener la IP: 192.168.10.254 Local de Mikrotik.

/ip address
add address=192.168.10.254/24 network=192.168.10.0 broadcast=192.168.10.255 interface=Ether5-Lan
add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=Ether1-WAN
add address=192.168.2.1/24 network=192.168.2.0 broadcast=192.168.2.255 interface=Ether2-WAN
add address=192.168.3.1/24 network=192.168.3.0 broadcast=192.168.3.255 interface=Ether3-WAN
add address=192.168.4.1/24 network=192.168.4.0 broadcast=192.168.4.255 interface=Ether4-WAN
/ip firewall mangle
add chain=input in-interface=Ether1-WAN action=mark-connection new-connection-mark=Ether1-WAN_conn
add chain=input in-interface=Ether2-WAN action=mark-connection new-connection-mark=Ether2-WAN_conn
add chain=input in-interface=Ether3-WAN action=mark-connection new-connection-mark=Ether3-WAN_conn
add chain=input in-interface=Ether4-WAN action=mark-connection new-connection-mark=Ether4-WAN_conn
add chain=output connection-mark=Ether1-WAN_conn action=mark-routing new-routing-mark=to_Ether1-WAN
add chain=output connection-mark=Ether2-WAN_conn action=mark-routing new-routing-mark=to_Ether2-WAN
add chain=output connection-mark=Ether3-WAN_conn action=mark-routing new-routing-mark=to_Ether3-WAN
add chain=output connection-mark=Ether4-WAN_conn action=mark-routing new-routing-mark=to_Ether4-WAN
add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Ether5-Lan
add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Ether5-Lan
add chain=prerouting dst-address=192.168.3.0/24 action=accept in-interface=Ether5-Lan
add chain=prerouting dst-address=192.168.4.0/24 action=accept in-interface=Ether5-Lan
add chain=prerouting dst-address-type=!local in-interface=Ether5-Lan per-connection-classifier=both-addresses:4/0 \ action=mark-connection new-connection-mark=Ether1-WAN_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Ether5-Lan per-connection-classifier=both-addresses:4/1 \ action=mark-connection new-connection-mark=Ether2-WAN_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Ether5-Lan per-connection-classifier=both-addresses:4/2 \ action=mark-connection new-connection-mark=Ether3-WAN_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Ether5-Lan per-connection-classifier=both-addresses:4/3 \ action=mark-connection new-connection-mark=Ether4-WAN_conn passthrough=yes
add chain=prerouting connection-mark=Ether1-WAN_conn in-interface=Ether5-Lan action=mark-routing new-routing-mark=to_Ether1-WAN
add chain=prerouting connection-mark=Ether2-WAN_conn in-interface=Ether5-Lan action=mark-routing new-routing-mark=to_Ether2-WAN
add chain=prerouting connection-mark=Ether3-WAN_conn in-interface=Ether5-Lan action=mark-routing new-routing-mark=to_Ether3-WAN
add chain=prerouting connection-mark=Ether4-WAN_conn in-interface=Ether5-Lan action=mark-routing new-routing-mark=to_Ether4-WAN
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.254 routing-mark=to_Ether1-WAN check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.254 routing-mark=to_Ether2-WAN check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.3.254 routing-mark=to_Ether3-WAN check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.4.254 routing-mark=to_Ether4-WAN check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.254 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.254 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.3.254 distance=3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.4.254 distance=4 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=Ether1-WAN action=masquerade
add chain=srcnat out-interface=Ether2-WAN action=masquerade
add chain=srcnat out-interface=Ether3-WAN action=masquerade
add chain=srcnat out-interface=Ether4-WAN action=masquerade

mcguti


D3M0N

es un balanceo común, sin ip publica no hay failover.