sinet.com.kh

Wednesday, January 24, 2018

Load Sharing 3 WAN and 3 LAN

Today we will show you how to configure Load Balancing 3 WAN with Static IP and 3 LAN  detail as bellow:
1. Comment Interface
2. Create Bride LAN
3. Configure IP Address for WAN1, WAN2, and WAN3
4. Configure IP Address for LAN1, LAN2, and LAN3
5. Configure DNS Server
6. Configure DHCP Server
7. Configure Mangle
8. Configure Routes
9. Configure NAT
10. Add Port to Bridge LAN

Flow: 
-LAN1 work on WAN1
-LAN2 work on WAN2
-LAN3 work on WAN3
*If WAN1 is down, the LAN1 will work on WAN2
*If WAN2 is down, the LAN2 will work on WAN3
*If WAN3 is down, the LAN3 will work on WAN1
*If WAN1 and WAN2 are down, the LAN1, LAN2, and LAN3 will work on WAN3
*If WAN1 and WAN3 are down, the LAN1, LAN2, and LAN3 will work on WAN2
*If WAN2 and WAN3 are down, the LAN1, LAN2, and LAN3 will work on WAN1

In this configuration we use MikroTik:CCR1009-8G-1S-1S+ and Firmware 6.41
1. Comment Interface
 /interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN1
set [ find default-name=ether2 ] name=ether2-LAN1
set [ find default-name=ether4 ] name=ether4-WAN2
set [ find default-name=ether5 ] name=ether5-LAN2
set [ find default-name=ether7 ] name=ether7-WAN3
set [ find default-name=ether8 ] name=ether8-LAN3

2. Create Bride LAN
/interface bridge
add fast-forward=no name=bridge-LAN1
add fast-forward=no name=bridge-LAN2
add fast-forward=no name=bridge-LAN3


3. Configure IP Address for WAN1, WAN2, and WAN3
 /ip address
add address=96.9.76.67/25 interface=ether1-WAN1 network=96.9.76.0
add address=103.14.250.196/24 interface=ether4-WAN2 network=103.14.250.0
add address=96.9.85.70/26 interface=ether7-WAN3 network=96.9.85.64


4. Configure IP Address for LAN1, LAN2, and LAN3
/ip address
add address=10.10.1.1/24 interface=bridge-LAN1 network=10.10.1.0
add address=10.10.2.1/24 interface=bridge-LAN2 network=10.10.2.0
add address=10.10.3.1/24 interface=bridge-LAN3 network=10.10.3.0


5. Configure DNS Server
/ip dns
set servers=8.8.8.8,8.8.4.4


6. Configure DHCP Server
/ip dhcp-server network
add address=10.10.1.0/24 gateway=10.10.1.1
add address=10.10.2.0/24 gateway=10.10.2.1
add address=10.10.3.0/24 gateway=10.10.3.1


/ip pool
add name=dhcp_pool1 ranges=10.10.1.10-10.10.1.254
add name=dhcp_pool2 ranges=10.10.2.10-10.10.2.254
add name=dhcp_pool3 ranges=10.10.3.10-10.10.3.254


/ip dhcp-server
add address-pool=dhcp_pool1 authoritative=after-2sec-delay disabled=no \
    interface=bridge-LAN1 name=dhcp1
add address-pool=dhcp_pool2 authoritative=after-2sec-delay disabled=no \
    interface=bridge-LAN2 name=dhcp2
add address-pool=dhcp_pool3 authoritative=after-2sec-delay disabled=no \
    interface=bridge-LAN3 name=dhcp3


7. Configure Mangle
/ip firewall mangle
add action=mark-routing chain=prerouting new-routing-mark=ISP-01 passthrough=\
    no src-address=10.10.1.0/24
add action=mark-routing chain=prerouting new-routing-mark=ISP-02 passthrough=\
    no src-address=10.10.2.0/24
add action=mark-routing chain=prerouting new-routing-mark=ISP-03 passthrough=\
    no src-address=10.10.3.0/24


8. Configure Routes
/ip route
add check-gateway=ping distance=1 gateway=96.9.76.1 routing-mark=ISP-01
add check-gateway=ping distance=1 gateway=103.14.250.1 routing-mark=ISP-02
add check-gateway=ping distance=1 gateway=96.9.85.65 routing-mark=ISP-03

add distance=1 gateway=96.9.76.1
add distance=1 gateway=103.14.250.1
add distance=1 gateway=96.9.85.65


9. Configure NAT
/ip firewall nat
add action=masquerade chain=srcnat
add action=masquerade chain=srcnat
add action=masquerade chain=srcnat


10. Add Port to Bridge LAN
/interface bridge port
add bridge=bridge-LAN1 interface=ether2-LAN1
add bridge=bridge-LAN2 interface=ether5-LAN2
 
add bridge=bridge-LAN3 interface=ether8-LAN3

Note: If we need to manage LAN2 work on WAN1 when WAN2 is down. We just add configuration as bellow:
/ip route
 add check-gateway=ping distance=2 gateway=103.14.250.1 routing-mark=ISP-01

No comments:

Post a Comment