Advertisement
punces

LB PCC PBR fail over 5 WAN

Jun 8th, 2017
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.55 KB | None | 0 0
  1. /ip route
  2. add check-gateway=ping comment=exit-1 distance=1 gateway=192.168.11.11 routing-mark=exit-1
  3. add check-gateway=ping comment=exit-2 distance=1 gateway=192.168.12.12 routing-mark=exit-2
  4. add check-gateway=ping comment=exit-1 distance=1 gateway=192.168.13.13 routing-mark=exit-3
  5. add check-gateway=ping comment=exit-2 distance=1 gateway=192.168.14.14 routing-mark=exit-4
  6. add check-gateway=ping comment=exit-1 distance=1 gateway=192.168.15.15 routing-mark=exit-5
  7.  
  8. add check-gateway=ping comment=jalur-1 distance=1 gateway=192.168.11.11 routing-mark=jalur-1
  9. add check-gateway=ping comment=jalur-1 distance=2 gateway=192.168.12.12 routing-mark=jalur-1
  10. add check-gateway=ping comment=jalur-1 distance=3 gateway=192.168.13.13 routing-mark=jalur-1
  11. add check-gateway=ping comment=jalur-1 distance=4 gateway=192.168.14.14 routing-mark=jalur-1
  12. add check-gateway=ping comment=jalur-1 distance=5 gateway=192.168.15.15 routing-mark=jalur-1
  13.  
  14. add check-gateway=ping comment=jalur-2 distance=1 gateway=192.168.12.12 routing-mark=jalur-2
  15. add check-gateway=ping comment=jalur-2 distance=2 gateway=192.168.13.13 routing-mark=jalur-2
  16. add check-gateway=ping comment=jalur-2 distance=3 gateway=192.168.14.14 routing-mark=jalur-2
  17. add check-gateway=ping comment=jalur-2 distance=4 gateway=192.168.15.15 routing-mark=jalur-2
  18. add check-gateway=ping comment=jalur-2 distance=5 gateway=192.168.11.11 routing-mark=jalur-2
  19.  
  20. add check-gateway=ping comment=jalur-3 distance=1 gateway=192.168.13.13 routing-mark=jalur-3
  21. add check-gateway=ping comment=jalur-3 distance=2 gateway=192.168.14.14 routing-mark=jalur-3
  22. add check-gateway=ping comment=jalur-3 distance=3 gateway=192.168.15.15 routing-mark=jalur-3
  23. add check-gateway=ping comment=jalur-3 distance=4 gateway=192.168.12.12 routing-mark=jalur-3
  24. add check-gateway=ping comment=jalur-3 distance=5 gateway=192.168.11.11 routing-mark=jalur-3
  25.  
  26. add check-gateway=ping comment=jalur-4 distance=1 gateway=192.168.14.14 routing-mark=jalur-4
  27. add check-gateway=ping comment=jalur-4 distance=2 gateway=192.168.15.15 routing-mark=jalur-4
  28. add check-gateway=ping comment=jalur-4 distance=3 gateway=192.168.13.13 routing-mark=jalur-4
  29. add check-gateway=ping comment=jalur-4 distance=4 gateway=192.168.12.12 routing-mark=jalur-4
  30. add check-gateway=ping comment=jalur-4 distance=5 gateway=192.168.11.11 routing-mark=jalur-4
  31.  
  32. add check-gateway=ping comment=jalur-4 distance=1 gateway=192.168.15.15 routing-mark=jalur-4
  33. add check-gateway=ping comment=jalur-4 distance=2 gateway=192.168.11.11 routing-mark=jalur-4
  34. add check-gateway=ping comment=jalur-4 distance=3 gateway=192.168.12.12 routing-mark=jalur-4
  35. add check-gateway=ping comment=jalur-4 distance=4 gateway=192.168.13.13 routing-mark=jalur-4
  36. add check-gateway=ping comment=jalur-4 distance=5 gateway=192.168.14.14 routing-mark=jalur-4
  37.  
  38. add check-gateway=ping comment=jalur-1 distance=1 gateway=192.168.11.11
  39. add check-gateway=ping comment=jalur-2 distance=2 gateway=192.168.12.12
  40. add check-gateway=ping comment=jalur-3 distance=3 gateway=192.168.13.13
  41. add check-gateway=ping comment=jalur-4 distance=4 gateway=192.168.14.14
  42. add check-gateway=ping comment=jalur-4 distance=5 gateway=192.168.15.15
  43.  
  44. /ip firewall address-list
  45. add address=10.0.0.0/8 list=private-lokal
  46. add address=172.16.0.0/12 list=private-lokal
  47. add address=192.168.0.0/16 list=private-lokal
  48.  
  49. /ip firewall filter
  50. add action=drop chain=input comment=dns-flood dst-port=53,5353 protocol=tcp src-address-list=!private-lokal
  51. add action=drop chain=input comment=dns-flood dst-port=53,5353 protocol=udp src-address-list=!private-lokal
  52. add action=drop chain=forward comment=dns-flood dst-port=53,5353 protocol=tcp src-address-list=!private-lokal
  53. add action=drop chain=forward comment=dns-flood dst-port=53,5353 protocol=udp src-address-list=!private-lokal
  54.  
  55. # ip game online silahkan copas di terminal winbox dari https://pastebin.com/raw/q0xFVpqb
  56.  
  57. #agar input dan output sesuai dengan jalurnya masing-masing
  58. /ip firewall mangle
  59. add action=mark-connection chain=input comment=exit-1 in-interface=ether1 new-connection-mark=exit-1 passthrough=yes
  60. add action=mark-connection chain=input comment=exit-2 in-interface=ether2 new-connection-mark=exit-2 passthrough=yes
  61. add action=mark-connection chain=input comment=exit-3 in-interface=ether3 new-connection-mark=exit-3 passthrough=yes
  62. add action=mark-connection chain=input comment=exit-4 in-interface=ether4 new-connection-mark=exit-4 passthrough=yes
  63. add action=mark-connection chain=input comment=exit-5 in-interface=ether5 new-connection-mark=exit-5 passthrough=yes
  64.  
  65. add action=mark-routing chain=output comment=exit-1 connection-mark=exit-1 new-routing-mark=exit-1 passthrough=no
  66. add action=mark-routing chain=output comment=exit-2 connection-mark=exit-2 new-routing-mark=exit-2 passthrough=no
  67. add action=mark-routing chain=output comment=exit-3 connection-mark=exit-3 new-routing-mark=exit-3 passthrough=no
  68. add action=mark-routing chain=output comment=exit-4 connection-mark=exit-4 new-routing-mark=exit-4 passthrough=no
  69. add action=mark-routing chain=output comment=exit-5 connection-mark=exit-5 new-routing-mark=exit-5 passthrough=no
  70.  
  71. #Bila LB PCC murni :
  72. /ip firewall mangle
  73. add action=mark-routing chain=prerouting comment=jalur-1 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-1 passthrough=yes per-connection-classifier=both-addresses-and-ports:5/0 src-address-list=private-lokal
  74. add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-2 passthrough=yes per-connection-classifier=both-addresses-and-ports:5/1 src-address-list=private-lokal
  75. add action=mark-routing chain=prerouting comment=jalur-3 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-3 passthrough=yes per-connection-classifier=both-addresses-and-ports:5/2 src-address-list=private-lokal
  76. add action=mark-routing chain=prerouting comment=jalur-4 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-4 passthrough=yes per-connection-classifier=both-addresses-and-ports:5/3 src-address-list=private-lokal
  77. add action=mark-routing chain=prerouting comment=jalur-5 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-5 passthrough=yes per-connection-classifier=both-addresses-and-ports:5/4 src-address-list=private-lokal
  78.  
  79. #Bila jalur-1 untuk port game online, dan jalur 2,3,4,5 di LB PCC :
  80. /ip firewall mangle
  81. #accept tcp port game di jalur-1
  82. add action=accept chain=prerouting src-address-list=private-lokal dst-address-list=games dst-port=!21,22,23,80,81,88,5050,843,443,182,8777,1935,8000-8081 protocol=tcp src-address-list=private-lokal
  83.  
  84. #accept udp port game di jalur-1
  85. add action=accept chain=prerouting src-address-list=private-lokal dst-address-list=games dst-port=!21,22,23,80,81,88,5050,843,443,182,8777,1935,8000-8081 protocol=udp src-address-list=private-lokal
  86.  
  87. #LB PCC jalur 2,3,4,5
  88. add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-2 passthrough=yes per-connection-classifier=both-addresses-and-ports:4/0 src-address-list=private-lokal
  89. add action=mark-routing chain=prerouting comment=jalur-3 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-3 passthrough=yes per-connection-classifier=both-addresses-and-ports:4/1 src-address-list=private-lokal
  90. add action=mark-routing chain=prerouting comment=jalur-4 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-4 passthrough=yes per-connection-classifier=both-addresses-and-ports:4/2 src-address-list=private-lokal
  91. add action=mark-routing chain=prerouting comment=jalur-5 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-5 passthrough=yes per-connection-classifier=both-addresses-and-ports:4/3 src-address-list=private-lokal
  92.  
  93. #Bila jalur-1 dan jalur 2 untuk port game online, dan jalur 3,4,5 di LB PCC :
  94. /ip firewall mangle
  95. #LB PCC tcp port game
  96. add action=mark-routing chain=prerouting comment=jalur-1 dst-address-list=games dst-port=!21,22,23,80,81,88,5050,843,443,182,8777,1935,8000-8081 protocol=tcp dst-address-type=!local new-routing-mark=jalur-1 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address-list=private-lokal
  97. add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=games dst-port=!21,22,23,80,81,88,5050,843,443,182,8777,1935,8000-8081 protocol=tcp dst-address-type=!local new-routing-mark=jalur-2 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address-list=private-lokal
  98.  
  99. #LB PCC udp port game
  100. add action=mark-routing chain=prerouting comment=jalur-1 dst-address-list=games dst-port=!21,22,23,80,81,88,5050,843,443,182,8777,1935,8000-8081 protocol=udp dst-address-type=!local new-routing-mark=jalur-1 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address-list=private-lokal
  101. add action=mark-routing chain=prerouting comment=jalur-2 dst-address-list=games dst-port=!21,22,23,80,81,88,5050,843,443,182,8777,1935,8000-8081 protocol=udp dst-address-type=!local new-routing-mark=jalur-2 passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address-list=private-lokal
  102.  
  103. #LB PCC jalur 3,4,5
  104. add action=mark-routing chain=prerouting comment=jalur-3 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-3 passthrough=yes per-connection-classifier=both-addresses-and-ports:3/0 src-address-list=private-lokal
  105. add action=mark-routing chain=prerouting comment=jalur-4 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-4 passthrough=yes per-connection-classifier=both-addresses-and-ports:3/1 src-address-list=private-lokal
  106. add action=mark-routing chain=prerouting comment=jalur-5 dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-5 passthrough=yes per-connection-classifier=both-addresses-and-ports:3/2 src-address-list=private-lokal
  107.  
  108.  
  109.  
  110. #buatlah system sechedule dengan nama "fail-over" dengan interval 5s
  111. #untuk cek apakah setiap modem masih ada koneksi internet atau tidak
  112. #bila modem tersebut tanpa koneksi internet, maka tidak perlu mematikan modem
  113. #karena otomatis akan berpindah jalur ke modem yang ada koneksi internetnya
  114. #copykan scrit dibawah ini pada bagian on-ovent :
  115.  
  116. #jalur-1 cek
  117. :if ([/ping address=208.67.222.222 interface=ether1 routing=exit-1 count=5] = 0) do={/ip route set [find comment=jalur-1 gateway=192.168.11.11 distance=1] distance=6} else={/ip route set [find comment=jalur-1 gateway=192.168.11.11 distance=6] distance=1};
  118.  
  119. #jalur-2 cek
  120. :if ([/ping address=208.67.222.222 interface=ether2 routing=exit-2 count=5] = 0) do={/ip route set [find comment=jalur-2 gateway=192.168.12.12 distance=1] distance=6} else={/ip route set [find comment=jalur-2 gateway=192.168.12.12 distance=6] distance=1};
  121.  
  122. #jalur-3 cek
  123. :if ([/ping address=208.67.222.222 interface=ether3 routing=exit-3 count=5] = 0) do={/ip route set [find comment=jalur-3 gateway=192.168.13.13 distance=1] distance=6} else={/ip route set [find comment=jalur-3 gateway=192.168.13.13 distance=6] distance=1};
  124.  
  125. #jalur-4 cek
  126. :if ([/ping address=208.67.222.222 interface=ether4 routing=exit-4 count=5] = 0) do={/ip route set [find comment=jalur-4 gateway=192.168.14.14 distance=1] distance=6} else={/ip route set [find comment=jalur-4 gateway=192.168.14.14 distance=6] distance=1};
  127.  
  128. #jalur-5 cek
  129. :if ([/ping address=208.67.222.222 interface=ether5 routing=exit-5 count=5] = 0) do={/ip route set [find comment=jalur-5 gateway=192.168.15.15 distance=1] distance=6} else={/ip route set [find comment=jalur-5 gateway=192.168.15.15 distance=6] distance=1};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement