Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # jan/22/2020 12:33:14 by RouterOS 6.46.1
- # software id = 1YMY-GLP1
- #
- # model = 951Ui-2HnD
- # serial number = 43CE0283BA9E
- /interface bridge
- add arp=reply-only name=LAN
- /interface ethernet
- set [ find default-name=ether1 ] comment=RTK
- set [ find default-name=ether2 ] comment=NTK
- set [ find default-name=ether3 ] comment=MGK
- /interface wireless
- set [ find default-name=wlan1 ] ssid=MikroTik
- /interface wireless security-profiles
- set [ find default=yes ] supplicant-identity=MikroTik
- /ip pool
- add name=pool0 ranges=10.10.0.2-10.10.0.254
- add name=pool1 ranges=10.10.1.2-10.10.1.254
- add name=pool3 ranges=10.10.3.2-10.10.3.254
- /ip dhcp-server
- add add-arp=yes address-pool=pool3 disabled=no interface=LAN name=dhcp
- /queue simple
- add max-limit=3M/3M name="block 10.10.0.0/24" target=10.10.0.0/24
- add max-limit=2M/2M name="block 10.10.1.0/24" target=10.10.1.0/24
- add max-limit=1M/1M name="block 10.10.3.0/24" target=10.10.3.0/24
- /interface bridge port
- add bridge=LAN interface=wlan1
- add bridge=LAN interface=ether4
- add bridge=LAN interface=ether5
- /ip address
- add address=1.1.1.1 interface=ether1 network=1.1.1.5
- add address=2.2.2.2 interface=ether2 network=2.2.2.5
- add address=192.168.88.35 interface=ether3 network=192.168.88.1
- add address=10.10.0.1/24 interface=LAN network=10.10.0.0
- add address=10.10.1.1/24 interface=LAN network=10.10.1.0
- add address=10.10.3.1/24 interface=LAN network=10.10.3.0
- /ip dhcp-server lease
- add address=10.10.1.250 mac-address=70:85:C2:FF:4C:8E server=dhcp
- /ip dhcp-server network
- add address=10.10.0.0/24 dns-server=10.10.0.1 gateway=10.10.0.1 ntp-server=\
- 10.10.0.1
- add address=10.10.1.0/24 dns-server=10.10.1.1 gateway=10.10.1.1 ntp-server=\
- 10.10.1.1
- add address=10.10.3.0/24 dns-server=10.10.3.1 gateway=10.10.3.1 next-server=\
- 10.10.3.5 ntp-server=10.10.3.1
- /ip dns
- set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4,10.10.0.11
- /ip firewall address-list
- add address=10.10.3.250 disabled=yes list=RZV
- add address=10.10.0.0/24 list=0_0
- add address=10.10.1.0/24 list=1_0
- add address=10.10.3.0/24 list=3_0
- /ip firewall mangle
- add action=mark-connection chain=prerouting comment=ISP1 in-interface=ether1 \
- new-connection-mark=From-ISP1 passthrough=yes
- add action=mark-routing chain=prerouting connection-mark=From-ISP1 \
- new-routing-mark=to-ISP1 passthrough=yes
- add action=mark-routing chain=output connection-mark=From-ISP1 \
- new-routing-mark=to-ISP1 passthrough=yes
- add action=mark-routing chain=output new-routing-mark=to-ISP1 passthrough=yes \
- src-address=1.1.1.1
- add action=mark-connection chain=prerouting comment=ISP2 in-interface=ether2 \
- new-connection-mark=From-ISP2 passthrough=yes
- add action=mark-routing chain=prerouting connection-mark=From-ISP2 \
- new-routing-mark=to-ISP2 passthrough=yes
- add action=mark-routing chain=output connection-mark=From-ISP2 \
- new-routing-mark=to-ISP2 passthrough=yes
- add action=mark-routing chain=output new-routing-mark=to-ISP2 passthrough=yes \
- src-address=2.2.2.2
- add action=mark-connection chain=prerouting comment=ISP3 in-interface=ether3 \
- new-connection-mark=From-ISP3 passthrough=yes
- add action=mark-routing chain=prerouting connection-mark=From-ISP3 \
- new-routing-mark=to-ISP3 passthrough=yes
- add action=mark-routing chain=output connection-mark=From-ISP3 \
- new-routing-mark=to-ISP3 passthrough=yes
- add action=mark-routing chain=output new-routing-mark=to-ISP3 passthrough=yes \
- src-address=192.168.88.1
- add action=mark-routing chain=prerouting comment=LAN_0_ISP1 disabled=yes \
- new-routing-mark=ISP1 passthrough=no src-address-list=0_0
- add action=mark-routing chain=prerouting comment=LAN_1_ISP1 disabled=yes \
- new-routing-mark=ISP1 passthrough=no src-address-list=1_0
- add action=mark-routing chain=prerouting comment=LAN_3_ISP1 disabled=yes \
- new-routing-mark=ISP1 passthrough=no src-address-list=3_0
- add action=mark-routing chain=prerouting comment=LAN_0_ISP2 new-routing-mark=\
- ISP2 passthrough=no src-address-list=0_0
- add action=mark-routing chain=prerouting comment=LAN_1_ISP2 new-routing-mark=\
- ISP2 passthrough=no src-address-list=1_0
- add action=mark-routing chain=prerouting comment=LAN_3_ISP2 disabled=yes \
- new-routing-mark=ISP2 passthrough=no src-address-list=3_0
- add action=mark-routing chain=prerouting comment=LAN_3_ISP3 log-prefix=ISP3_ \
- new-routing-mark=ISP3 passthrough=no src-address-list=3_0
- add action=mark-routing chain=prerouting comment=RZV disabled=yes \
- new-routing-mark=ISP3 passthrough=no src-address-list=RZV
- /ip firewall nat
- add action=masquerade chain=srcnat out-interface=ether1
- add action=masquerade chain=srcnat out-interface=ether2
- add action=masquerade chain=srcnat out-interface=ether3
- /ip route
- add distance=1 gateway=1.1.1.5 routing-mark=ISP1
- add distance=1 gateway=2.2.2.5 routing-mark=ISP2
- add distance=1 gateway=192.168.88.1 routing-mark=ISP3
- add comment=WAN1 distance=1 gateway=1.1.1.5
- add comment=WAN2 distance=2 gateway=2.2.2.5
- add comment=WAN3 distance=3 gateway=192.168.88.1
- /ip route rule
- add src-address=1.1.1.1/32 table=ISP1
- add src-address=2.2.2.2/32 table=ISP2
- add src-address=192.168.88.35/32 table=ISP3
- add dst-address=10.10.0.0/24 table=main
- add dst-address=10.10.1.0/24 table=main
- add dst-address=10.10.3.0/24 table=main
- add routing-mark=to-ISP1 table=ISP1
- add routing-mark=to-ISP2 table=ISP2
- add routing-mark=to-ISP3 table=ISP3
- /system clock
- set time-zone-name=Asia/Novosibirsk
- /system ntp client
- set enabled=yes primary-ntp=78.36.11.161 secondary-ntp=78.36.11.161
- /system ntp server
- set enabled=yes multicast=yes
- /system script
- add dont-require-permissions=no name=check_isp owner=admin policy=\
- ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
- ISP1\r\
- \n:global RTK ether3\r\
- \n#ISP2\r\
- \n:global NTK ether2\r\
- \n#ISP3\r\
- \n:global MGK ether1\r\
- \n\r\
- \n:local PingCount 1\r\
- \n\r\
- \n:local PingTargets {77.88.8.8; 8.8.8.8}\r\
- \n:local host\r\
- \n\r\
- \n:local RTKInetOk false\r\
- \n:local NTKInetOk false\r\
- \n:local MGKInetOk false\r\
- \n:local RTKPings 0\r\
- \n:local NTKPings 0\r\
- \n:local MGKPings 0\r\
- \n\r\
- \nforeach host in=\$PingTargets do={\r\
- \n:local res [/ping \$host count=\$PingCount interface=\$RTK]\r\
- \n:set RTKPings (\$RTKPings + \$res)\r\
- \n:local res [/ping \$host count=\$PingCount interface=\$NTK]\r\
- \n:set NTKPings (\$NTKPings + \$res)\r\
- \n:local res [/ping \$host count=\$PingCount interface=\$MGK]\r\
- \n:set MGKPings (\$MGKPings + \$res)\r\
- \n:delay 1\r\
- \n}\r\
- \n\r\
- \n:set RTKInetOk (\$RTKPings >= 1)\r\
- \n:set NTKInetOk (\$NTKPings >= 1)\r\
- \n:set MGKInetOk (\$MGKPings >= 1)\r\
- \n\r\
- \n:put \"RTKInetOk=\$RTKInetOk\"\r\
- \n:put \"NTKInetOk=\$NTKInetOk\"\r\
- \n:put \"MGKInetOk=\$MGKInetOk\"\r\
- \n\r\
- \nif (\$RTKInetOk && \$NTKInetOk && \$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP1+ISP2+ISP3\"\r\
- \n/log info \"switched to ISP1+ISP2+ISP3\"\r\
- \n}\r\
- \n\r\
- \nif (!\$RTKInetOk && \$NTKInetOk && \$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP2+ISP3\"\r\
- \n/log info \"switched to ISP2+ISP3\"\r\
- \n}\r\
- \n\r\
- \nif (\$RTKInetOk && !\$NTKInetOk && \$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP1+ISP3\"\r\
- \n/log info \"switched to ISP1+ISP3\"\r\
- \n}\r\
- \n\r\
- \nif (\$RTKInetOk && \$NTKInetOk && !\$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP1+ISP2\"\r\
- \n/log info \"switched to ISP1+ISP2\"\r\
- \n}\r\
- \n\r\
- \nif (!\$RTKInetOk && \$NTKInetOk && !\$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP2\"\r\
- \n/log info \"switched to ISP2\"\r\
- \n}\r\
- \n\r\
- \nif (\$RTKInetOk && !\$NTKInetOk && !\$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP1\"\r\
- \n/log info \"switched to ISP1\"\r\
- \n}\r\
- \n\r\
- \nif (!\$RTKInetOk && !\$NTKInetOk && \$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall mangle enable [find comment=\"RZV\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to ISP3\"\r\
- \n/log info \"switched to ISP3\"\r\
- \n}\r\
- \n\r\
- \nif (!\$RTKInetOk && !\$NTKInetOk && !\$MGKInetOk) do={\r\
- \n/ip firewall mangle disable [find comment=\"LAN_0_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP1\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_1_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"LAN_3_ISP2\"]\r\
- \n/ip firewall mangle disable [find comment=\"RZV\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_1_ISP1\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_0_ISP2\"]\r\
- \n/ip firewall mangle enable [find comment=\"LAN_3_ISP3\"]\r\
- \n/ip firewall connection remove [find ]\r\
- \n:put \"switched to No Internet\"\r\
- \n/log info \"switched to No Internet\"\r\
- \n}\r\
- \n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement