Load Balancing and Fail Over with Mikrotik


Load Balancing to combine Internet connections from two ISPs, while making a gateway fail over as backup.
This sample I have tried in the Mikrotik version of 3:30 and runs smoothly, we begin to be ok
First you need an interface card must be three pieces: one for the LAN and two for the WAN.
> interface pr
Flags: D - dynamic, X - disabled, R - running, S - slave
# NAME TYPE MTU L2MTU
0 R WAN2 ether 1500
1 R WAN1 ether 1500
2 R LAN ether 1500 1600
Now add the ip addresses (customize to your network)
> ip address add address=172.16.0.30/27 interface=LAN disabled=no
> ip address add address=192.168.1.100/24 interface=WAN1 disabled=no
> ip address add address=192.168.10.100/24 interface=WAN2 disabled=no
> ip address pr
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 172.16.0.30/27 172.16.0.0 172.16.0.31 LAN
1 192.168.1.100/24 192.168.1.0 192.168.1.255 WAN1
2 192.168.10.100/24 192.168.10.0 192.168.10.255 WAN2
Each interface has the ip is in accordance with network conditions, then stayed to give her gateway
> ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1,192.168.10.1 check-gateway=ping
> ip route pr
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC GATEWAY-STATE GATEWAY DISTANCE INTERFACE
0 A S 0.0.0.0/0 reachable 192.168.1.1 1 WAN1
reachable 192.168.10.1 WAN2
172.16.0.30 0 1 ADC 172.16.0.0/27 LAN
2 ADC 192.168.1.0/24 192.168.1.100 0 WAN1
3 ADC 192.168.10.0/24 192.168.10.100 0 wan2
Gateway we make two accordance with our plans before, and the example above, assuming both have a large WAN bandwidth the same, you can use asymmetric bandwidth links also - for example one link is 1Mbps other 2Mbps. Just use gateway=192.168.1.1,192.168.10.1,192.168.10.1
Adding NAT
> ip firewall nat add chain=srcnat out-interface=WAN1 action=masquerade
> ip firewall nat add chain=srcnat out-interface=WAN2 action=masquerade
> Ip firewall per night
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat action=masquerade out-interface=WAN1
1 chain=srcnat action=masquerade out-interface=WAN2
But, sometimes even there are one WAN down why we need to create a fail over that function if one uses a single WAN gateway direct die alone.
> Ip firewall missing add chain = input in-interface = WAN1 action = mark-connection new-connection-mark = wan1_conn
> Ip firewall missing add chain = input in-interface = WAN2 action = mark-connection new-connection-mark = wan2_conn
> Ip firewall missing add chain = output connection-mark = wan1_conn action = mark-routing new-routing-mark = ke_wan1
> Ip firewall missing add chain = output connection-mark = wan2_conn action = mark-routing new-routing-mark = ke_wan2
> Ip firewall missing per
Flags: X - disabled, I - invalid, D - dynamic
0 chain=input action=mark-connection new-connection-mark=wan1_conn passthrough=yes in-interface=WAN1
1 chain=input action=mark-connection new-connection-mark=wan2_conn passthrough=yes in-interface=WAN2
2 chain=output action=mark-routing new-routing-mark=ke_wan1 passthrough=yes connection-mark=wan1_conn
3 chain=output action=mark-routing new-routing-mark=ke_wan2 passthrough=yes connection-mark=wan2_conn
[admin@MikroTik] > ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=ke_wan1
[admin@MikroTik] > ip route add dst-address=0.0.0.0/0 gateway=192.168.10.1 routing-mark=ke_wan2
[admin@MikroTik] > ip route pr
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC GATEWAY-STATE GATEWAY DISTANCE INTERFACE
0 A S 0.0.0.0/0 reachable 192.168.10.1 1 WAN2
1 A S 0.0.0.0/0 reachable 192.168.1.1 1 WAN1
2 A S 0.0.0.0/0 reachable 192.168.1.1 1 WAN1
reachable 192.168.10.1 WAN2
3 172.16.0.30 0 ADC 172.16.0.0/27 LAN
4 ADC 192.168.1.0/24 192.168.1.100 0 WAN1
5 ADC 192.168.10.0/24 192.168.10.100 0 wan2

Related Posts by Categories



Widget by Hoctro | Jack Book
Kode Iklan anda yang ingin ada di sebelah kanan disini

0 comments: