sinet.com.kh

Saturday, July 30, 2016

Mikrotik Router Load Balancing 2WAN and 2LAN

1. Comment Interface

/interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN1
set [ find default-name=ether2 ] name=ether2-WAN2
set [ find default-name=ether3 ] name=ether3-LAN1
set [ find default-name=ether4 ] name=ether4-LAN2

2. Setting Up IP Address (WAN and LAN)

/ip address
add address=203.217.170.30/24 interface=ether1-WAN1 network=203.217.170.0
add address=103.14.250.55/24 interface=ether2-WAN2 network=103.14.250.0
add address=192.168.1.1/24 interface=ether3-LAN1 network=192.168.1.0
add address=172.16.1.1/24 interface=ether4-LAN2 network=172.16.1.0 

3. Setting Up DNS

 /ip dns
set servers=203.217.168.27,203.217.168.36

4. Setting Up DHCP Server

 /ip pool
add name=dhcp_pool1 ranges=192.168.1.2-192.168.1.254
add name=dhcp_pool2 ranges=172.16.1.2-172.16.1.254
/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=ether3-LAN1 lease-time=1d name=dhcp1
add address-pool=dhcp_pool2 disabled=no interface=ether4-LAN2 lease-time=1d name=dhcp2

5. Setting Up NAT

/ip firewall nat
add action=masquerade chain=srcnat log-prefix="" 

6. Setting Up Mangle

/ip firewall mangle
add action=accept chain=prerouting dst-address=172.16.1.0/24 log-prefix=""    src-address=192.168.1.0/24
add action=accept chain=prerouting dst-address=192.168.1.0/24 log-prefix="" src-address=172.16.1.0/24
add action=accept chain=prerouting dst-address=192.168.1.0/24 log-prefix="" src-address=192.168.1.0/24
add action=accept chain=prerouting dst-address=172.16.1.0/24 log-prefix="" src-address=172.16.1.0/24
add action=mark-routing chain=prerouting log-prefix="" new-routing-mark=WAN1 passthrough=no src-address=192.168.1.0/24
add action=mark-routing chain=prerouting log-prefix="" new-routing-mark=WAN2 passthrough=no src-address=172.16.1.0/24

7. Setting Up Route

/ip route
add check-gateway=ping distance=1 gateway=203.217.170.1 routing-mark=WAN1
add check-gateway=ping distance=2 gateway=103.14.250.1 routing-mark=WAN1
add check-gateway=ping distance=1 gateway=103.14.250.1 routing-mark=WAN2
add check-gateway=ping distance=2 gateway=203.217.170.1 routing-mark=WAN2

8. Setting Up Simple Queue for Local Bandwidth 

/queue simple
add dst=172.16.1.0/24 max-limit=100M/100M name=Local target=192.168.1.0/24

.

No comments:

Post a Comment