IP LAN=192.168.56.1/24
IP WAN1=192.168.1.2/27
IP WAN2=10.10.10.2/27
gateway WAN1=192.168.1.1
gateway WAN2=10.10.10.1
######==========START PCC load balancing=============########
/interface
set ether1 name=ether-LAN
set ether2 name=ether-WAN1
set ether3 name=ether-WAN2
/ip address
add address=192.168.56.1/24 network=192.168.56.0 broadcast=192.168.0.255 interface=ether-LAN
add address=192.168.1.2/27 network=192.168.1.0 broadcast= 192.168.1.31 interface=ether-WAN1
add address=10.10.10.2/27 network=10.10.11.0 broadcast=10.10.10.0.31 interface=ether-WAN2
/ip firewall mangle
add chain=prerouting dst-address=192.168.1.0/27 action=accept in-interface=ether-LAN
add chain=prerouting dst-address=10.10.11.0/27 action=accept in-interface=ether-LAN
add action=mark-connection chain=input comment="Mark new inbound connection WAN1" connection-state=new disabled=no in-interface=ether-WAN1 new-connection-mark=WAN1 passthrough=yes
add action=mark-connection chain=input comment="Mark new inbound connection WAN2" connection-state=new disabled=no in-interface=ether-WAN2 new-connection-mark=WAN2 passthrough=yes
add action=mark-routing chain=output comment="Mark new inbound route WAN1" connection-mark=WAN1 connection-state=new disabled=no new-routing-mark=WAN1 passthrough=no
add action=mark-routing chain=output comment="Mark new inbound route WAN2" connection-mark=WAN2 connection-state=new disabled=no new-routing-mark=WAN2 passthrough=no
add action=mark-connection chain=prerouting comment="Mark new established connection WAN1" connection-state=established disabled=no in-interface=ether-WAN1 new-connection-mark=WAN1 passthrough=yes
add action=mark-connection chain=prerouting comment="Mark new established connection WAN2" connection-state=established disabled=no in-interface=ether-WAN2 new-connection-mark=WAN2 passthrough=yes
add action=mark-routing chain=output comment="Mark new established route WAN1" connection-mark=WAN1 connection-state=established disabled=no new-routing-mark=to_WAN1 passthrough=no
add action=mark-routing chain=output comment="Mark new established route WAN2" connection-mark=WAN2 connection-state=established disabled=no new-routing-mark=to_WAN2 passthrough=no
##PILIH SALAH SATU (sample1 / sampele2)
# sample1 round robin outbound traffic routing, based on src port and src address
/ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=ether-LAN per-connection-classifier=src-address-and-port:2/0 action=mark-connection new-connection-mark=WAN1_pcc_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=ether-LAN per-connection-classifier=src-address-and-port:2/1 action=mark-connection new-connection-mark=WAN2_pcc_conn passthrough=yes
add chain=prerouting connection-mark=WAN1_pcc_conn in-interface=ether-LAN action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_pcc_conn in-interface=ether-LAN action=mark-routing new-routing-mark=to_WAN2
# sample2 round robin outbound traffic routing, based on both-addresses-and-ports
/ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=ether-LAN per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_pcc_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=ether-LAN per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_pcc_conn passthrough=yes
add chain=prerouting connection-mark=WAN1_pcc_conn in-interface=ether-LAN action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_pcc_conn in-interface=ether-LAN action=mark-routing new-routing-mark=to_WAN2
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.10.1 routing-mark=to_WAN2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.10.1 distance=2 check-gateway=ping
/ip firewall nat
add action=masquerade chain=srcnat comment="" disabled=no out-interface=ether-WAN1
add action=masquerade chain=srcnat comment="" disabled=no out-interface=ether-WAN2
######==========END PCC load balancing=============########
1 komentar:
mantaf kang.....lanjutkan
Posting Komentar