Advertisement
dedeanshi

New LB 2 WAN

Dec 29th, 2019
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.39 KB | None | 0 0
  1. # ROS 6.4x.x
  2. # Sebelum copas ke terminal, ubah nama interface pada ether arah lan menjadi "LAN"
  3. # Pastikan ISP 1 berada pada ether1
  4. # Pastikan ISP 2 berada pada ether2
  5. # buat route ke ISP 1 dengan mark routing to_isp1
  6. # buat route ke ISP 2 dengan mark routing to_isp2
  7. # buat default route dengan gateway isp 1 dan 2
  8. # script ini untuk 2 WAN dan menggunakan ip 192.168.100.1 sebagai gateway ISP 1, 192.168.200.1 sebagai gateway ISP 2
  9. # untuk memudahkan penyesuaian ip gateway gunakan "find replace"
  10. /sys note set note="script by AGASTHANET"
  11.  
  12.  
  13. /ip fi address-list
  14. add address=10.0.0.0/8 list=rfc1918
  15. add address=172.16.0.0/12 list=rfc1918
  16. add address=192.168.0.0/16 list=rfc1918
  17. /ip firewall mangle
  18. 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
  19. add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether2 new-connection-mark=cm_in_isp2 passthrough=yes
  20. add action=mark-routing chain=output connection-mark=cm_in_isp1 new-routing-mark=to_isp1
  21. add action=mark-routing chain=output connection-mark=cm_in_isp2 new-routing-mark=to_isp2
  22. 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
  23. add action=mark-connection chain=nth-balancer in-interface=LAN new-connection-mark=cm_nth_balancer_1 nth=2,1 passthrough=yes
  24. add action=mark-connection chain=nth-balancer in-interface=LAN new-connection-mark=cm_nth_balancer_2 nth=2,2 passthrough=yes
  25. add action=return chain=nth-balancer
  26. 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
  27. add action=mark-routing chain=prerouting connection-mark=cm_nth_balancer_2 in-interface=LAN new-routing-mark=to_isp2 passthrough=no
  28. 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
  29. add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=LAN jump-target=pcc-balancer protocol=tcp
  30. add action=jump chain=prerouting dst-address-list=!rfc1918 in-interface=LAN jump-target=pcc-balancer protocol=udp
  31. 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:2/0
  32. 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:2/1
  33. add action=return chain=pcc-balancer in-interface=LAN
  34. 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
  35. add action=mark-routing chain=prerouting connection-mark=cm_pcc_balancer_2 in-interface=LAN new-routing-mark=to_isp2 passthrough=no
  36. # --------------------------------------------------------------------- #  
  37. /ip route
  38. add check-gateway=ping distance=1 gateway=192.168.100.1 routing-mark=to_isp1 comment="ISP 1"
  39. add check-gateway=ping distance=1 gateway=192.168.200.1 routing-mark=to_isp2 comment="ISP 2"
  40. add check-gateway=ping distance=1 gateway=192.168.100.1,192.168.200.1 comment="Def_Route"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement