unps

Untitled

Feb 8th, 2020
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. /ppp profile
  2. set *0 remote-address=192.168.99.1
  3. add comment="for PPPoE to ISP1" interface-list=WAN name=isp1_client on-down="/\
  4. ip firewall nat remove [find comment=\"NAT via ISP1\"];\r\
  5. \n/ip route remove [find comment=\"For recursion via ISP1\"];\r\
  6. \n/ip route remove [find comment=\"Unmarked via ISP1\"];\r\
  7. \n/ip route remove [find comment=\"Marked via ISP1 Main\"];\r\
  8. \n/ip route remove [find comment=\"Marked via ISP2 Backup1\"];\r\
  9. \n/ip route rule set [find comment=\"From ISP1 IP to Inet\"] disabled=yes;\
  10. " on-up="/ip route add check-gateway=ping comment=\"For recursion via ISP1\
  11. \" distance=1 dst-address=4.2.2.1/32 gateway=\$\"remote-address\" scope=10\
  12. \r\
  13. \n/ip route add check-gateway=ping comment=\"Unmarked via ISP1\" distance=\
  14. 1 gateway=4.2.2.1;\r\
  15. \n/ip route add comment=\"Marked via ISP1 Main\" distance=1 gateway=4.2.2.\
  16. 1 routing-mark=to_isp1;\r\
  17. \n/ip route add comment=\"Marked via ISP2 Backup1\" distance=1 gateway=4.2\
  18. .2.1 routing-mark=to_isp2;\r\
  19. \n/ip firewall mangle set [find comment=\"Connmark in from ISP1\"] in-inte\
  20. rface=\$\"interface\";\r\
  21. \n/ip firewall nat add action=src-nat chain=srcnat ipsec-policy=out,none o\
  22. ut-interface=\$\"interface\" to-addresses=\$\"local-address\" comment=\"NA\
  23. T via ISP1\" place-before=0;\r\
  24. \nif ([/ip route rule find comment=\"From ISP1 IP to Inet\"] =\"\") do={\r\
  25. \n /ip route rule add comment=\"From ISP1 IP to Inet\" src-address=\$\"l\
  26. ocal-address\" table=to_isp1 \r\
  27. \n} else={\r\
  28. \n /ip route rule set [find comment=\"From ISP1 IP to Inet\"] disabled=n\
  29. o src-address=\$\"local-address\"\r\
  30. \n};\r\
  31. \n"
  32. add comment="for PPPoE to ISP2" interface-list=WAN name=isp2_client on-down="/\
  33. ip firewall nat remove [find comment=\"NAT via ISP2\"];\r\
  34. \n/ip route remove [find comment=\"For recursion via ISP2\"];\r\
  35. \n/ip route remove [find comment=\"Unmarked via ISP2\"];\r\
  36. \n/ip route remove [find comment=\"Marked via ISP2 Main\"];\r\
  37. \n/ip route remove [find comment=\"Marked via ISP1 Backup2\"];\r\
  38. \n/ip route rule set [find comment=\"From ISP2 IP to Inet\"] disabled=yes;\
  39. " on-up="/ip route add check-gateway=ping comment=\"For recursion via ISP2\
  40. \" distance=1 dst-address=4.2.2.2/32 gateway=\$\"remote-address\" scope=10\
  41. \r\
  42. \n/ip route add check-gateway=ping comment=\"Unmarked via ISP2\" distance=\
  43. 2 gateway=4.2.2.2;\r\
  44. \n/ip route add comment=\"Marked via ISP2 Main\" distance=1 gateway=4.2.2.\
  45. 2 routing-mark=to_isp2;\r\
  46. \n/ip route add comment=\"Marked via ISP1 Backup2\" distance=2 gateway=4.2\
  47. .2.2 routing-mark=to_isp1;\r\
  48. \n/ip firewall mangle set [find comment=\"Connmark in from ISP2\"] in-inte\
  49. rface=\$\"interface\";\r\
  50. \n/ip firewall nat add action=src-nat chain=srcnat ipsec-policy=out,none o\
  51. ut-interface=\$\"interface\" to-addresses=\$\"local-address\" comment=\"NA\
  52. T via ISP2\" place-before=0;\r\
  53. \nif ([/ip route rule find comment=\"From ISP2 IP to Inet\"] =\"\") do={\r\
  54. \n /ip route rule add comment=\"From ISP2 IP to Inet\" src-address=\$\"l\
  55. ocal-address\" table=to_isp2 \r\
  56. \n} else={\r\
  57. \n /ip route rule set [find comment=\"From ISP2 IP to Inet\"] disabled=n\
  58. o src-address=\$\"local-address\"\r\
  59. \n};"
  60.  
  61. ===
  62.  
  63. /interface pppoe-client
  64. add comment="to ISP2" disabled=no interface=ether2 name=pppoe-ISP2 \
  65. profile=isp2_client user=user2
  66. add comment="to ISP1" disabled=no interface=ether1 max-mtu=1480 name=\
  67. pppoe-ISP1 profile=isp1_client user=user1
  68.  
  69. ===
  70.  
  71. /ip route
  72. add comment="Marked via ISP2 Backup1" distance=1 gateway=4.2.2.1 \
  73. routing-mark=to_isp2
  74. add comment="Marked via ISP2 Main" distance=1 gateway=4.2.2.2 routing-mark=\
  75. to_isp2
  76. add comment="Marked via ISP1 Main" distance=1 gateway=4.2.2.1 routing-mark=\
  77. to_isp1
  78. add comment="Marked via ISP1 Backup2" distance=2 gateway=4.2.2.2 \
  79. routing-mark=to_isp1
  80. add check-gateway=ping comment="Unmarked via ISP1" distance=1 gateway=4.2.2.1
  81. add check-gateway=ping comment="Unmarked via ISP2" distance=2 gateway=4.2.2.2
  82. add check-gateway=ping comment="For recursion via ISP1" distance=1 \
  83. dst-address=4.2.2.1/32 gateway=192.168.40.1 scope=10
  84. add check-gateway=ping comment="For recursion via ISP2" distance=1 \
  85. dst-address=4.2.2.2/32 gateway=10.1.3.49 scope=10
  86. /ip route rule
  87. add comment="From ISP1 IP to Inet" src-address=10.1.24.90/32 table=to_isp1
  88. add comment="From ISP2 IP to Inet" src-address=10.77.156.61/32 table=to_isp2
Advertisement
Add Comment
Please, Sign In to add comment