Saturday 21 October 2017

2 WAN DYNAMIC DHCP-CLIENT LOAD BALANCE / 2 ISP dinamic Load balance




ISP1 => ether1 => WAN1 ( 192.168.1.1/24 )
ISP2 => ether2 => WAN2 ( 192.168.2.1/24 )
LAN => ether3 => LAN ( 192.168.2.0/24 )

# DHCP CLIENT
/ip dhcp-client
add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=WAN1 use-peer-dns=no use-peer-ntp=no
add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=WAN2 use-peer-dns=no use-peer-ntp=no

# IP ADDRESS LAN
/ip address
add address=192.168.2.1/24 interface=ether3 network=192.168.2.0

# MANGLE
/ip firewall mangle
add action=mark-connection chain=prerouting comment="Load Balance" connection-state=new in-interface=WAN1 new-connection-mark=WAN1_conn
add action=mark-connection chain=prerouting connection-state=new in-interface=WAN1 new-connection-mark=WAN2_conn

add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1
add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2

add action=mark-connection chain=prerouting connection-state=new dst-address-type=!local in-interface=LAN new-connection-mark=WAN1_conn per-connection-classifier=both-ports:2/0
add action=mark-connection chain=prerouting connection-state=new dst-address-type=!local in-interface=LAN new-connection-mark=WAN2_conn per-connection-classifier=both-ports:2/1

add action=mark-routing chain=prerouting connection-mark=WAN1_conn in-interface=ether3 new-routing-mark=to_WAN1
add action=mark-routing chain=prerouting connection-mark=WAN2_conn in-interface=ether3 new-routing-mark=to_WAN2

Tb :
- !local => Buat address list IP LAN client
- per-connection-classifier=both-ports:2/0 ( jika ada lebih dari 2 lan, bisa dirubah menjadi 3/0 atau 4/0
- in-interface=LAN = untuk in-interface=LAN bisa di kosongkan, jika LAN2 dan LAN3 tidak terkoneksi internet

# ROUTES
/ip route
add check-gateway=ping comment="WAN1 routing gateway" distance=1 gateway=192.168.0.1 routing-mark=to_WAN1
add check-gateway=ping comment="WAN2 routing gateway" distance=1 gateway=192.168.1.1 routing-mark=to_WAN2
add comment=WAN1-wan distance=1 gateway=192.168.1.1
add comment=WAN2-wan distance=2 gateway=192.168.2.1


1 comment:

  1. add check-gateway=ping comment="WAN1 routing gateway" distance=1 gateway=192.168.0.1 routing-mark=to_WAN1
    add check-gateway=ping comment="WAN2 routing gateway" distance=1 gateway=192.168.1.1 routing-mark=to_WAN2

    ga salah ketik itu om.,, gateway nya?
    WAN 1 koq = 192.168.0.1 ?????

    ReplyDelete