Вы находитесь на странице: 1из 3

# AGREGAR LAS IP

/ ip address
add address=192.168.5.1/24 network=192.168.5.0 broadcast=192.168.5.255
interface=internal

add address=192.168.1.222/24 network=192.168.1.0 broadcast=192.168.1.255


interface=WAN1
add address=192.168.2.222/24 network=192.168.2.0 broadcast=192.168.2.255
interface=WAN2

add address=192.168.3.222/24 network=192.168.3.0 broadcast=192.168.3.255


interface=WAN3

add address=192.168.4.222/24 network=192.168.4.0 broadcast=192.168.4.255


interface=WAN4

Cerramos New Terminal y lo volvemos a abrir (esto se hace cada vez que
inserte un línea de código nueva) copias el siguiente código:

# BALANCEO DE CARGA NTH


/ ip firewall mangle
add chain=prerouting in-interface=internal connection-state=new nth=4,1
action=mark-connection new-connection-mark=Mark1 passthrough=yes
add chain=prerouting in-interface=internal connection-mark=Mark1 action=mark-
routing new-routing-mark=AWA passthrough=no

add chain=prerouting in-interface=internal connection-state=new nth=3,1


action=mark-connection new-connection-mark=Mark2 passthrough=yes
add chain=prerouting in-interface=internal connection-mark=Mark2 action=mark-
routing new-routing-mark=AWB passthrough=no

add chain=prerouting in-interface=internal connection-state=new nth=2,1


action=mark-connection new-connection-mark=Mark3 passthrough=yes
add chain=prerouting in-interface=internal connection-mark=Mark3 action=mark-
routing new-routing-mark=AWC passthrough=no

add chain=prerouting in-interface=internal connection-state=new nth=1,1


action=mark-connection new-connection-mark=Mark4 passthrough=yes
add chain=prerouting in-interface=internal connection-mark=Mark4 action=mark-
routing new-routing-mark=AWD passthrough=no

# ENMASCARADO
/ ip firewall nat
add chain=srcnat connection-mark=Mark1 out-interface=WAN1
action=masquerade
add chain=srcnat connection-mark=Mark2 out-interface=WAN2
action=masquerade

add chain=srcnat connection-mark=Mark3 out-interface=WAN3


action=masquerade
add chain=srcnat connection-mark=Mark4 out-interface=WAN4
action=masquerade

# OPCIONAL - ACCESO A ROUTERS DEL PROVEEDOR


/ip firewall mangle
add chain=prerouting dst-address=192.168.1.1 in-interface=internal connection-
state=new action=mark-connection new-connection-mark=Mark1 passthrough=no
add chain=prerouting dst-address=192.168.2.1 in-interface=internal connection-
state=new action=mark-connection new-connection-mark=Mark2 passthrough=no

add chain=prerouting dst-address=192.168.3.1 in-interface=internal connection-


state=new action=mark-connection new-connection-mark=Mark3 passthrough=no
add chain=prerouting dst-address=192.168.4.1 in-interface=internal connection-
state=new action=mark-connection new-connection-mark=Mark4 passthrough=no

# ENRUTAMIENTO ESTATICO
/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 scope=254 target-
scope=10 routing-mark=AWA
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=1 scope=254 target-
scope=10 routing-mark=AWB

add dst-address=0.0.0.0/0 gateway=192.168.3.1 distance=1 scope=254 target-


scope=10 routing-mark=AWC
add dst-address=0.0.0.0/0 gateway=192.168.4.1 distance=1 scope=254 target-
scope=10 routing-mark=AWD

Ahora algo muy importante, se trata de un Failover mediante ruteo


recursivo, esto funciona obligando a cada link a hacer ping a una IP publica
preestablecida (en este caso servidores de Google y OPNDNS), si recibe
respuesta activara la conexión, de lo contrario la deshabilitara hasta que se
encuentre disponible de nuevo. ::::

# FAILOVER BASICO USANDO DNS DE GOOGLE


/ ip route
add dst-address=0.0.0.0/0 gateway=8.8.8.8 check-gateway=ping distance=1
scope=30 target-scope=10
add dst-address=0.0.0.0/0 gateway=8.8.4.4 check-gateway=ping distance=2
scope=30 target-scope=10

add dst-address=0.0.0.0/0 gateway=208.67.222.222 check-gateway=ping


distance=3 scope=30 target-scope=10
add dst-address=0.0.0.0/0 gateway=208.67.220.220 check-gateway=ping
distance=4 scope=30 target-scope=10

add dst-address=8.8.8.8 gateway=192.168.1.1 distance=1 scope=10 target-


scope=10
add dst-address=8.8.4.4 gateway=192.168.2.1 distance=1 scope=10 target-
scope=10

add dst-address=208.67.222.222 gateway=192.168.3.1 distance=1 scope=10


target-scope=10
add dst-address=208.67.220.220 gateway=192.168.4.1 distance=1 scope=10
target-scope=10

tutoeial en youtbe: https://www.youtube.com/watch?v=EXnGiZRssq8

Вам также может понравиться