Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ROS 6.4x.x
- # Sebelum copas ke terminal, ubah nama interface pada ether arah lan menjadi "LAN"
- # Pastikan ISP 1 berada pada ether1
- # Pastikan ISP 2 berada pada ether2
- # Pastikan ISP 3 berada pada ether3
- # Pastikan ISP 4 berada pada ether4
- # buat route ke ISP 1 dengan mark routing to_isp1
- # buat route ke ISP 2 dengan mark routing to_isp2
- # buat route ke ISP 3 dengan mark routing to_isp3
- # buat route ke ISP 4 dengan mark routing to_isp4
- # buat default route dengan gateway isp 1 dan 2
- # script ini untuk 3 WAN dan menggunakan ip 192.168.10.1 sebagai gateway ISP 1, 192.168.20.1 sebagai gateway ISP 2, 192.168.30.1 sebagai gateway ISP 3
- # untuk memudahkan penyesuaian ip gateway gunakan "find replace"
- /sys note set note="script by AGASTHANET"
- /ip fi address-list
- add address=10.0.0.0/8 list=rfc1918
- add address=172.16.0.0/12 list=rfc1918
- add address=192.168.0.0/16 list=rfc1918
- /ip firewall mangle
- add action=mark-connection chain=prerouting comment="IN/OUT FOR EACH WAN" connection-mark=no-mark in-interface=ether1 new-connection-mark=cm_in_isp1 passthrough=yes
- add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether2 new-connection-mark=cm_in_isp2 passthrough=yes
- add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether3 new-connection-mark=cm_in_isp3 passthrough=yes
- add action=mark-routing chain=output connection-mark=cm_in_isp1 new-routing-mark=to_isp1
- add action=mark-routing chain=output connection-mark=cm_in_isp2 new-routing-mark=to_isp2
- add action=mark-routing chain=output connection-mark=cm_in_isp3 new-routing-mark=to_isp3
- add action=jump chain=prerouting comment= "LB NTH JUMPER [!!! only for tcp 80 traffic]" connection-state=new dst-address-list=!rfc1918 dst-port=80 in-interface=all-ethernet jump-target=nth-balancer protocol=tcp
- add action=mark-connection chain=nth-balancer in-interface=LAN new-connection-mark=cm_nth_balancer_1 nth=3,1 passthrough=yes
- add action=mark-connection chain=nth-balancer in-interface=LAN new-connection-mark=cm_nth_balancer_2 nth=3,2 passthrough=yes
- add action=mark-connection chain=nth-balancer in-interface=LAN new-connection-mark=cm_nth_balancer_3 nth=3,3 passthrough=yes
- add action=return chain=nth-balancer
- add action=mark-routing chain=prerouting comment="LB NTH ROUTE" connection-mark=cm_nth_balancer_1 in-interface=LAN new-routing-mark=to_isp1 passthrough=no
- add action=mark-routing chain=prerouting connection-mark=cm_nth_balancer_2 in-interface=LAN new-routing-mark=to_isp2 passthrough=no
- add action=mark-routing chain=prerouting connection-mark=cm_nth_balancer_3 in-interface=LAN new-routing-mark=to_isp3 passthrough=no
- add action=jump chain=prerouting comment="LB PCC JUMPER [for any traffic]" dst-address-list=!rfc1918 in-interface=LAN jump-target=pcc-balancer protocol=!ospf
- add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=LAN jump-target=pcc-balancer protocol=tcp
- add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=LAN jump-target=pcc-balancer protocol=udp
- add action=mark-connection chain=pcc-balancer comment= "LB PCC BALANCER CLASSIFIER" in-interface=LAN new-connection-mark= cm_pcc_balancer_1 passthrough=yes per-connection-classifier= both-addresses-and-ports:3/0
- add action=mark-connection chain=pcc-balancer in-interface=LAN new-connection-mark=cm_pcc_balancer_2 passthrough=yes per-connection-classifier=both-addresses-and-ports:3/1
- add action=mark-connection chain=pcc-balancer in-interface=LAN new-connection-mark=cm_pcc_balancer_3 passthrough=yes per-connection-classifier=both-addresses-and-ports:3/2
- add action=return chain=pcc-balancer in-interface=LAN
- add action=mark-routing chain=prerouting comment="LB PCC ROUTE" connection-mark=cm_pcc_balancer_1 in-interface=LAN new-routing-mark=to_isp1 passthrough=no
- add action=mark-routing chain=prerouting connection-mark=cm_pcc_balancer_2 in-interface=LAN new-routing-mark=to_isp2 passthrough=no
- add action=mark-routing chain=prerouting connection-mark=cm_pcc_balancer_3 in-interface=LAN new-routing-mark=to_isp3 passthrough=no
- # --------------------------------------------------------------------- #
- /ip route
- add check-gateway=ping distance=1 gateway=192.168.10.1 routing-mark=to_isp1 comment="ISP 1"
- add check-gateway=ping distance=1 gateway=192.168.20.1 routing-mark=to_isp2 comment="ISP 2"
- add check-gateway=ping distance=1 gateway=192.168.30.1 routing-mark=to_isp3 comment="ISP 3"
- add check-gateway=ping distance=1 gateway=192.168.10.1,192.168.20.1,192.168.30.1 comment="Def_Route"
Add Comment
Please, Sign In to add comment