Advertisement
punces

auto-switch-dns-sehat-trust-dan-open

Mar 8th, 2017
2,353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. #AUTO SWITCH DNS-SEHAT / DNS-TRUST / DNS-OPEN
  2. #COPY DAN PASTE KE TERMINAL WINBOX
  3.  
  4. /ip firewall address-list
  5. add address=10.0.0.0/8 list=private-lokal
  6. add address=172.16.0.0/12 list=private-lokal
  7. add address=192.168.0.0/16 list=private-lokal
  8.  
  9. /ip firewall filter
  10. add action=drop chain=input comment=dns-flood dst-port=53,5353 protocol=tcp src-address-list=!private-lokal
  11. add action=drop chain=input comment=dns-flood dst-port=53,5353 protocol=udp src-address-list=!private-lokal
  12. add action=drop chain=forward comment=dns-flood dst-port=53,5353 protocol=tcp src-address-list=!private-lokal
  13. add action=drop chain=forward comment=dns-flood dst-port=53,5353 protocol=udp src-address-list=!private-lokal
  14.  
  15. /ip dns
  16. set allow-remote-requests=no servers=208.67.222.222,208.67.220.220
  17.  
  18. /ip firewall nat
  19. add action=dst-nat chain=dstnat comment=dns-sehat src-address-list=private-lokal disabled=no dst-port=53,5353 nth=4,1 protocol=tcp to-addresses=103.80.80.248 to-ports=5353
  20. add action=dst-nat chain=dstnat comment=dns-sehat src-address-list=private-lokal disabled=no dst-port=53,5353 nth=2,1 protocol=tcp to-addresses=103.80.80.249 to-ports=5353
  21. add action=dst-nat chain=dstnat comment=dns-sehat src-address-list=private-lokal disabled=no dst-port=53,5353 nth=3,1 protocol=udp to-addresses=103.80.80.248 to-ports=5353
  22. add action=dst-nat chain=dstnat comment=dns-sehat src-address-list=private-lokal disabled=no dst-port=53,5353 nth=1,1 protocol=udp to-addresses=103.80.80.249 to-ports=5353
  23.  
  24. /ip firewall nat
  25. add action=dst-nat chain=dstnat comment=dns-trust src-address-list=private-lokal disabled=no dst-port=53,5353 nth=4,1 protocol=tcp to-addresses=103.80.80.243 to-ports=5353
  26. add action=dst-nat chain=dstnat comment=dns-trust src-address-list=private-lokal disabled=no dst-port=53,5353 nth=2,1 protocol=tcp to-addresses=103.80.80.244 to-ports=5353
  27. add action=dst-nat chain=dstnat comment=dns-trust src-address-list=private-lokal disabled=no dst-port=53,5353 nth=3,1 protocol=udp to-addresses=103.80.80.243 to-ports=5353
  28. add action=dst-nat chain=dstnat comment=dns-trust src-address-list=private-lokal disabled=no dst-port=53,5353 nth=1,1 protocol=udp to-addresses=103.80.80.244 to-ports=5353
  29.  
  30. /ip firewall nat
  31. add action=dst-nat chain=dstnat comment=dns-open src-address-list=private-lokal disabled=no dst-port=53,5353 nth=4,1 protocol=tcp to-addresses=208.67.222.222 to-ports=53
  32. add action=dst-nat chain=dstnat comment=dns-open src-address-list=private-lokal disabled=no dst-port=53,5353 nth=2,1 protocol=tcp to-addresses=208.67.220.220 to-ports=53
  33. add action=dst-nat chain=dstnat comment=dns-open src-address-list=private-lokal disabled=no dst-port=53,5353 nth=3,1 protocol=udp to-addresses=208.67.222.222 to-ports=53
  34. add action=dst-nat chain=dstnat comment=dns-open src-address-list=private-lokal disabled=no dst-port=53,5353 nth=1,1 protocol=udp to-addresses=208.67.220.220 to-ports=53
  35.  
  36. /system scheduler
  37. add interval=10s name=auto-switch-dns on-event="#cek dns-sehat\r\
  38. \n:if (([/ping address=103.80.80.248 count=1] > 0) && ([/ping address=103.80.80.249 count=1] > 0)) do={/ip firewall nat enable [find comment=\"dns-sehat\" disabled=y\
  39. es]};\r\
  40. \n:if (([/ping address=103.80.80.248 count=1] = 0) || ([/ping address=103.80.80.249 count=1] = 0)) do={/ip firewall nat disable [find comment=\"dns-sehat\" disabled=\
  41. no]};\r\
  42. \n\r\
  43. \n#cek dns-trust\r\
  44. \n:if (([/ping address=103.80.80.243 count=1] > 0) && ([/ping address=103.80.80.244 count=1] > 0)) do={/ip firewall nat enable [find comment=\"dns-trust\" disabled=y\
  45. es]};\r\
  46. \n:if (([/ping address=103.80.80.243 count=1] = 0) || ([/ping address=103.80.80.244 count=1] = 0)) do={/ip firewall nat disable [find comment=\"dns-trust\" disabled=\
  47. no]};\r\
  48. \n\r\
  49. \n#cek dns-open\r\
  50. \n:if (([/ping address=208.67.222.222 count=1] > 0) && ([/ping address=208.67.220.220 count=1] > 0)) do={/ip firewall nat enable [find comment=\"dns-open\" disabled=\
  51. yes]};\r\
  52. \n:if (([/ping address=208.67.222.222 count=1] = 0) || ([/ping address=208.67.220.220 count=1] = 0)) do={/ip firewall nat disable [find comment=\"dns-open\" disabled\
  53. =no]};"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement