Loadbalancing PCC 4 WAN

Kali ini saya akan membagikan script loadbalancing 4 WAN , langsung saja ya guys di dibawah ini..





/interface ethernet
set [ find default-name=ether2 ] name=ether2-modem-1-100Mbps
set [ find default-name=ether3 ] name=ether3-modem-2-100Mbps
set [ find default-name=ether4 ] name=ether4-modem-3-100Mbps
set [ find default-name=ether5 ] name=ether5-modem-4-100Mbps


/ip address
add address=192.168.20.25/24 interface=ether4-modem-3-100Mbps network=192.168.20.0
add address=192.168.1.25/24 interface=ether2-modem-1-100Mbps network=192.168.1.0
add address=192.168.2.25/24 interface=ether3-modem-2-100Mbps network=192.168.2.0
add address=192.168.100.25/24 interface=ether5-modem-4-100Mbps network=192.168.100.0


/ip firewall address-list
add address=204.15.20.0/22 list=facebook
add address=0.0.0.0/8 list=private-lokal
add address=10.0.0.0/8 list=private-lokal
add address=100.64.0.0/10 list=private-lokal
add address=127.0.0.0/8 list=private-lokal
add address=169.254.0.0/16 list=private-lokal
add address=172.16.0.0/12 list=private-lokal
add address=192.0.0.0/24 list=private-lokal
add address=192.0.2.0/24 list=private-lokal
add address=192.168.0.0/16 list=private-lokal
add address=198.18.0.0/15 list=private-lokal
add address=198.51.100.0/24 list=private-lokal
add address=203.0.113.0/24 list=private-lokal
add address=224.0.0.0/3 list=private-lokal
add address=192.168.48.0/21 list=private-lokal
add address=192.168.99.0/24 list=private-lokal
add address=192.168.60.0/24 list=private-lokal

/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether2-modem-1-100Mbps
add action=masquerade chain=srcnat out-interface=ether3-modem-2-100Mbps
add action=masquerade chain=srcnat out-interface=ether4-modem-3-100Mbps
add action=masquerade chain=srcnat out-interface=ether5-modem-4-100Mbps


/ip firewall mangle
add action=mark-connection chain=prerouting in-interface=ether2-modem-1-100Mbps new-connection-mark=WAN1_PCC_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=ether3-modem-2-100Mbps new-connection-mark=WAN2_PCC_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=ether4-modem-3-100Mbps new-connection-mark=WAN3_PCC_conn passthrough=yes
add action=mark-connection chain=prerouting in-interface=ether5-modem-4-100Mbps new-connection-mark=WAN4_PCC_conn passthrough=yes
add action=mark-connection chain=prerouting comment="Loadbalance PCC" dst-address-list=!private-lokal dst-address-type=!local hotspot="" new-connection-mark=WAN1_PCC_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:4/0
add action=mark-connection chain=prerouting dst-address-list=!private-lokal dst-address-type=!local new-connection-mark=WAN2_PCC_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/1
add action=mark-connection chain=prerouting dst-address-list=!private-lokal dst-address-type=!local new-connection-mark=WAN3_PCC_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/2
add action=mark-connection chain=prerouting dst-address-list=!private-lokal dst-address-type=!local new-connection-mark=WAN4_PCC_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/3
add action=mark-routing chain=prerouting connection-mark=WAN1_PCC_conn new-routing-mark=to_PCC_WAN1 passthrough=yes src-address-list=private-lokal
add action=mark-routing chain=prerouting connection-mark=WAN2_PCC_conn new-routing-mark=to_PCC_WAN2 passthrough=yes src-address-list=private-lokal
add action=mark-routing chain=prerouting connection-mark=WAN3_PCC_conn new-routing-mark=to_PCC_WAN3 passthrough=yes src-address-list=private-lokal
add action=mark-routing chain=prerouting connection-mark=WAN4_PCC_conn new-routing-mark=to_PCC_WAN4 passthrough=yes src-address-list=private-lokal
add action=mark-routing chain=output connection-mark=WAN1_PCC_conn new-routing-mark=to_PCC_WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_PCC_conn new-routing-mark=to_PCC_WAN2 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN3_PCC_conn new-routing-mark=to_PCC_WAN3 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN4_PCC_conn new-routing-mark=to_PCC_WAN4 passthrough=yes


/ip route
add comment=DEFAULT-1 distance=1 gateway=192.168.1.1 routing-mark=to_PCC_WAN1
add comment=DEFAULT-2 distance=1 gateway=192.168.2.1 routing-mark=to_PCC_WAN2
add comment=DEFAULT-3 distance=1 gateway=192.168.20.1 routing-mark=to_PCC_WAN3
add comment=DEFAULT-4 distance=1 gateway=192.168.100.1 routing-mark=to_PCC_WAN4
add check-gateway=ping distance=1 gateway=192.168.1.1
add check-gateway=ping distance=2 gateway=192.168.2.1
add check-gateway=ping disabled=yes distance=3 gateway=192.168.20.1
add check-gateway=ping disabled=yes distance=4 gateway=192.168.100.1

Semoga Bermanfaat
Penulis : Een Pahlefi,S.Kom

Subscribe to receive free email updates: