View difference between Paste ID: imEbyEUQ and cUAaRUyw
SHOW: | | - or go back to the newest paste.
1
/ip route remove [find dynamic=no]
2
3
/ip route
4
add check-gateway=ping comment=satu distance=1 gateway=192.168.120.1
5
add check-gateway=ping comment=dua distance=2 gateway=192.168.130.1
6
add check-gateway=ping comment=tiga distance=3 gateway=192.168.140.1
7
add check-gateway=ping comment=empat distance=4 gateway=192.168.150.1
8
/ip route
9
add check-gateway=ping comment=exit-1 distance=1 gateway=192.168.120.1 routing-mark=exit-1
10
add check-gateway=ping comment=exit-2 distance=1 gateway=192.168.130.1 routing-mark=exit-2
11
add check-gateway=ping comment=exit-3 distance=1 gateway=192.168.140.1 routing-mark=exit-3
12
add check-gateway=ping comment=exit-4 distance=1 gateway=192.168.150.1 routing-mark=exit-4
13
/ip route
14
add check-gateway=ping comment=jalur-1 distance=1 gateway=192.168.120.1 routing-mark=jalur-1
15
add check-gateway=ping comment=jalur-2 distance=1 gateway=192.168.130.1 routing-mark=jalur-2
16
add check-gateway=ping comment=jalur-3 distance=1 gateway=192.168.140.1 routing-mark=jalur-3
17
add check-gateway=ping comment=jalur-4 distance=1 gateway=192.168.150.1 routing-mark=jalur-4
18
/ip route
19
add check-gateway=ping comment=jalur-1 distance=1 gateway=192.168.120.1 routing-mark=jalur-1
20
add check-gateway=ping comment=jalur-2 distance=2 gateway=192.168.130.1 routing-mark=jalur-1
21
add check-gateway=ping comment=jalur-3 distance=3 gateway=192.168.140.1 routing-mark=jalur-1
22
add check-gateway=ping comment=jalur-4 distance=4 gateway=192.168.150.1 routing-mark=jalur-1
23
/ip route
24
add check-gateway=ping comment=jalur-2 distance=1 gateway=192.168.130.1 routing-mark=jalur-2
25
add check-gateway=ping comment=jalur-3 distance=2 gateway=192.168.140.1 routing-mark=jalur-2
26
add check-gateway=ping comment=jalur-4 distance=3 gateway=192.168.150.1 routing-mark=jalur-2
27
add check-gateway=ping comment=jalur-1 distance=4 gateway=192.168.120.1 routing-mark=jalur-2
28
/ip route
29
add check-gateway=ping comment=jalur-3 distance=1 gateway=192.168.140.1 routing-mark=jalur-3
30
add check-gateway=ping comment=jalur-4 distance=2 gateway=192.168.150.1 routing-mark=jalur-3
31
add check-gateway=ping comment=jalur-1 distance=3 gateway=192.168.120.1 routing-mark=jalur-3
32
add check-gateway=ping comment=jalur-2 distance=4 gateway=192.168.130.1 routing-mark=jalur-3
33
/ip route
34
add check-gateway=ping comment=jalur-4 distance=1 gateway=192.168.150.1 routing-mark=jalur-4
35
add check-gateway=ping comment=jalur-1 distance=2 gateway=192.168.120.1 routing-mark=jalur-4
36
add check-gateway=ping comment=jalur-2 distance=3 gateway=192.168.130.1 routing-mark=jalur-4
37
add check-gateway=ping comment=jalur-3 distance=4 gateway=192.168.140.1 routing-mark=jalur-4
38
39
/ip firewall mangle remove [find]
40
/ip firewall mangle
41
add action=accept chain=input dst-address-list=private-lokal src-address-list=private-lokal
42
add action=accept chain=prerouting dst-address-list=private-lokal src-address-list=private-lokal
43
add action=accept chain=forward dst-address-list=private-lokal src-address-list=private-lokal
44
add action=accept chain=postrouting dst-address-list=private-lokal src-address-list=private-lokal
45
add action=accept chain=output dst-address-list=private-lokal src-address-list=private-lokal
46
47
/ip firewall mangle
48
add action=mark-connection chain=input comment=exit-1 in-interface=ether1 new-connection-mark=exit-1 passthrough=yes
49
add action=mark-routing chain=prerouting comment=exit-1 connection-mark=exit-1 new-routing-mark=exit-1 passthrough=no
50
add action=mark-routing chain=output comment=exit-1 connection-mark=exit-1 new-routing-mark=exit-1 passthrough=no
51
add action=mark-connection chain=input comment=exit-2 in-interface=ether2 new-connection-mark=exit-2 passthrough=yes
52
add action=mark-routing chain=prerouting comment=exit-2 connection-mark=exit-2 new-routing-mark=exit-2 passthrough=no
53
add action=mark-routing chain=output comment=exit-2 connection-mark=exit-2 new-routing-mark=exit-2 passthrough=no
54
add action=mark-connection chain=input comment=exit-3 in-interface=ether3 new-connection-mark=exit-3 passthrough=yes
55
add action=mark-routing chain=prerouting comment=exit-3 connection-mark=exit-3 new-routing-mark=exit-3 passthrough=no
56
add action=mark-routing chain=output comment=exit-3 connection-mark=exit-3 new-routing-mark=exit-3 passthrough=no
57
add action=mark-connection chain=input comment=exit-4 in-interface=ether4 new-connection-mark=exit-4 passthrough=yes
58
add action=mark-routing chain=prerouting comment=exit-4 connection-mark=exit-4 new-routing-mark=exit-4 passthrough=no
59
add action=mark-routing chain=output comment=exit-4 connection-mark=exit-4 new-routing-mark=exit-4 passthrough=no
60
61
62
/ip firewall mangle
63
add action=mark-connection chain=prerouting comment=trafik connection-mark=no-mark dst-address-list=!private-lokal new-connection-mark=trafik passthrough=yes src-address-list=private-lokal
64
65
/ip firewall mangle
66
add action=mark-routing chain=prerouting comment=jalur-1 connection-mark=trafik dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-1 passthrough=no per-connection-classifier=both-addresses-and-ports:4/0 src-address-list=private-lokal
67
add action=mark-routing chain=prerouting comment=jalur-2 connection-mark=trafik dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-2 passthrough=no per-connection-classifier=both-addresses-and-ports:4/1 src-address-list=private-lokal
68
add action=mark-routing chain=prerouting comment=jalur-3 connection-mark=trafik dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-3 passthrough=no per-connection-classifier=both-addresses-and-ports:4/2 src-address-list=private-lokal
69
add action=mark-routing chain=prerouting comment=jalur-4 connection-mark=trafik dst-address-list=!private-lokal dst-address-type=!local new-routing-mark=jalur-4 passthrough=no per-connection-classifier=both-addresses-and-ports:4/3 src-address-list=private-lokal
70
71
/system scheduler
72
add interval=15s name=fail-over on-event="log warning (\"=============================\")\r\
73
    \n#jalur-1 cek\r\
74
    \n:if ([/ping address=8.8.8.8 interface=ether1 routing=exit-1 count=5] = 0) do={\r\
75
    \n/ip route disable [find comment=jalur-1 gateway=192.168.120.1 disabled=no]\r\
76
    \n/ip route set distance=6 [find comment=satu distance=1]\r\
77
    \nlog error (\"jalur-1 ether1 down\")\r\
78
    \n} else={\r\
79
    \n/ip route enable [find comment=jalur-1 gateway=192.168.120.1 disabled=yes]\r\
80
    \n/ip route set distance=1 [find comment=satu distance=6]\r\
81
    \nlog warning (\"jalur-1 ether1 up\")\r\
82
    \n};\r\
83
    \n\r\
84
    \n#jalur-2 cek\r\
85
    \n:if ([/ping address=8.8.8.8 interface=ether2 routing=exit-2 count=5] = 0) do={\r\
86
    \n/ip route disable [find comment=jalur-2 gateway=192.168.130.1 disabled=no]\r\
87
    \n/ip route set distance=7 [find comment=dua distance=2]\r\
88
    \nlog error (\"jalur-2 ether2 down\")\r\
89
    \n} else={\r\
90
    \n/ip route enable [find comment=jalur-2 gateway=192.168.130.1 disabled=yes]\r\
91
    \n/ip route set distance=2 [find comment=dua distance=7]\r\
92
    \nlog warning (\"jalur-2 ether2 up\")\r\
93
    \n};\r\
94
    \n\r\
95
    \n#jalur-3 cek\r\
96
    \n:if ([/ping address=8.8.8.8 interface=ether3 routing=exit-3 count=5] = 0) do={\r\
97
    \n/ip route disable [find comment=jalur-3 gateway=192.168.140.1 disabled=no]\r\
98
    \n/ip route set distance=8 [find comment=tiga distance=3]\r\
99
    \nlog error (\"jalur-3 ether3 down\")\r\
100
    \n} else={\r\
101
    \n/ip route enable [find comment=jalur-3 gateway=192.168.140.1 disabled=yes]\r\
102
    \n/ip route set distance=3 [find comment=tiga distance=8]\r\
103
    \nlog warning (\"jalur-3 ether3 up\")\r\
104
    \n};\r\
105
    \n\r\
106
    \n#jalur-4 cek\r\
107
    \n:if ([/ping address=8.8.8.8 interface=ether4 routing=exit-4 count=5] = 0) do={\r\
108
    \n/ip route disable [find comment=jalur-4 gateway=192.168.150.1 disabled=no]\r\
109
    \nlog error (\"jalur-4 ether4 down\")\r\
110
    \n} else={\r\
111
    \n/ip route enable [find comment=jalur-4 gateway=192.168.150.1 disabled=yes]\r\
112
    \nlog warning (\"jalur-4 ether4 up\")\r\
113
    \n};\r\
114
    \nlog warning (\"cek koneksi selesai\")\r\
115
    \nlog warning (\"=============================\")"