Load Balancing &; Fail Over RouterOS


Load Balancing & Fail Over
• Load Balancing is a technique to distribute the workload across two or more network links in order to maximize throughput, minimize response time, and avoid overload. 
• Fail Over protection system is to maintain if the primary link is interrupted, it will automatically enable the backup path (link the second, third, etc.) Type Load Balancing.

• Per Packet Load Balancing
- In MikroTik using a feature called Interface Bonding 
- The division of the load based on packet-packet (packet 1 via a gateway, packet 2 through gateway b)
• Per Connection Load Balancing
- Using features in IP Mikrotik Bernama NTH mangle 
- The division of the load based on connections (1 connection through a gateway, via the gateway connection to 2 b)
• Per address-pair connection Load Balancing
- Features ECMP and PCC (Peer Connection Classified) 
- Pebagian traffic based on the IP address of the connection and the origin and destination of the connection 
• Custom Load Balancing (Policy Routing -> route mark)
Equal Cost Multi Path (ECMP)
• ECMP allows the router has more than one gateway to one destination network. 
• Each gateway will be selected based on ECMP algorithm Round Roubin of combination SRC / DST address 
• The same gateway can be written repeatedly.

Script For 2 Line ISP :


/ip firewall address-list
add address=192.168.0.0/16 list=LOCAL-IP comment="LoadBalancing"
add address=172.16.0.0/12 list=LOCAL-IP comment="LoadBalancing"
add address=10.0.0.0/8 list=LOCAL-IP comment="LoadBalancing"

/ip firewall nat
add chain=srcnat out-interface="192.168.1.2/24" action=masquerade comment="LoadBalancing"
add chain=srcnat out-interface="" action=masquerade comment="LoadBalancing"

/ip route
add check-gateway=ping distance=1 gateway="192.168.2.2/24" routing-mark="to-192.168.1.2/24" comment="LoadBalancing"
add check-gateway=ping distance=1 gateway="" routing-mark="to-" comment="LoadBalancing"
add check-gateway=ping distance=1 gateway="192.168.2.2/24" comment="LoadBalancing"
add check-gateway=ping distance=2 gateway="" comment="LoadBalancing"

/ip firewall mangle
add action=mark-connection chain=input in-interface="192.168.1.2/24" new-connection-mark="cm-192.168.1.2/24" passthrough=yes comment="LoadBalancing"
add action=mark-connection chain=input in-interface="" new-connection-mark="cm-" passthrough=yes comment="LoadBalancing"
add action=mark-routing chain=output connection-mark="cm-192.168.1.2/24" new-routing-mark="to-192.168.1.2/24" passthrough=yes comment="LoadBalancing"
add action=mark-routing chain=output connection-mark="cm-" new-routing-mark="to-" passthrough=yes comment="LoadBalancing"
add action=mark-connection chain=prerouting dst-address-list=!LOCAL-IP dst-address-type=!local new-connection-mark="cm-192.168.1.2/24" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address-list=LOCAL-IP comment="LoadBalancing"
add action=mark-connection chain=prerouting dst-address-list=!LOCAL-IP dst-address-type=!local new-connection-mark="cm-" passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address-list=LOCAL-IP comment="LoadBalancing"
add action=mark-routing chain=prerouting connection-mark="cm-192.168.1.2/24" dst-address-list=!LOCAL-IP new-routing-mark="to-192.168.1.2/24" passthrough=yes src-address-list=LOCAL-IP comment="LoadBalancing"
add action=mark-routing chain=prerouting connection-mark="cm-" dst-address-list=!LOCAL-IP new-routing-mark="to-" passthrough=yes src-address-list=LOCAL-IP comment="LoadBalancing"

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel