Last active
March 20, 2022 12:53
-
-
Save TerAnYu/4666fc8ea8d54e08067c63ba6a36d9d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://habrahabr.ru/post/313342/ | |
# ROS 7 | |
in-interface=ISP1 - первый провайдер (основной) | |
in-interface=ISP2 - второй провайдер (резервный) | |
in-interface=ISP3 - третий провайдер (резервный резервного) | |
in-interface=bridge - интерфейс локальной сети | |
11.11.11.11 - дефолтный маршрут провайдера | |
22.22.22.22 - дефолтный маршрут провайдера | |
33.33.33.33 - дефолтный маршрут провайдера | |
/interface list add name=WAN | |
/interface list member add interface=ISP1 list=WAN | |
/interface list member add interface=ISP2 list=WAN | |
/interface list member add interface=ISP3 list=WAN | |
routing table add fib name=ISP1-route | |
routing table add fib name=ISP2-route | |
routing table add fib name=ISP3-route | |
/ip route add distance=1 gateway=11.11.11.11 routing-table=ISP1-route comment="ISP1 - https://habrahabr.ru/post/313342/" | |
/ip route add distance=1 gateway=22.22.22.22 routing-table=ISP2-route comment="ISP2 - https://habrahabr.ru/post/313342/" | |
/ip route add distance=1 gateway=33.33.33.33 routing-table=ISP3-route comment="ISP3 - https://habrahabr.ru/post/313342/" | |
/ip route add check-gateway=ping distance=1 gateway=192.5.5.241 comment="ISP1 - https://habrahabr.ru/post/313342/" | |
/ip route add check-gateway=ping distance=2 gateway=193.0.14.129 comment="ISP2 - https://habrahabr.ru/post/313342/" | |
/ip route add check-gateway=ping distance=3 gateway=192.36.148.17 comment="ISP3 - https://habrahabr.ru/post/313342/" | |
/ip route add distance=1 pref-src=[:local ipaddress [/ip address get [find interface~"ISP1"] address]; :put [:pick $ipaddress 0 [:find $ipaddress "/"]]] dst-address=192.5.5.241/32 gateway=11.11.11.11 scope=10 comment="ISP1 - https://habrahabr.ru/post/313342/" | |
/ip route add distance=1 pref-src=[:local ipaddress [/ip address get [find interface~"ISP2"] address]; :put [:pick $ipaddress 0 [:find $ipaddress "/"]]] dst-address=193.0.14.129/32 gateway=22.22.22.22 scope=10 comment="ISP2 - https://habrahabr.ru/post/313342/" | |
/ip route add distance=1 pref-src=[:local ipaddress [/ip address get [find interface~"ISP3"] address]; :put [:pick $ipaddress 0 [:find $ipaddress "/"]]] dst-address=192.36.148.17/32 gateway=33.33.33.33 scope=10 comment="ISP3 - https://habrahabr.ru/post/313342/" | |
/ip firewall mangle add action=mark-connection chain=input comment="ISP1 - https://habrahabr.ru/post/313342/" in-interface=ISP1 new-connection-mark=ISP1-conn passthrough=yes | |
/ip firewall mangle add action=mark-routing chain=output comment="ISP1 - https://habrahabr.ru/post/313342/" connection-mark=ISP1-conn new-routing-mark=ISP1-route passthrough=no | |
/ip firewall mangle add action=mark-connection chain=input comment="ISP2 - https://habrahabr.ru/post/313342/" in-interface=ISP2 new-connection-mark=ISP2-conn passthrough=yes | |
/ip firewall mangle add action=mark-routing chain=output comment="ISP2 - https://habrahabr.ru/post/313342/" connection-mark=ISP2-conn new-routing-mark=ISP2-route passthrough=no | |
/ip firewall mangle add action=mark-connection chain=input comment="ISP3 - https://habrahabr.ru/post/313342/" in-interface=ISP3 new-connection-mark=ISP3-conn passthrough=yes | |
/ip firewall mangle add action=mark-routing chain=output comment="ISP3 - https://habrahabr.ru/post/313342/" connection-mark=ISP3-conn new-routing-mark=ISP3-route passthrough=no | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP1 - https://habrahabr.ru/post/313342/" connection-mark=ISP1-conn-f in-interface-list=!WAN new-routing-mark=ISP1-route passthrough=yes | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP1 - https://habrahabr.ru/post/313342/ - \E0\E4\F0\E5\F1\E0 \F7\E5\F0\E5\E7 \F3\EA\E0\E7\E0\ED\ED\FB\E9 \EC\E0\F0\F8\F0\F3\F2" connection-state=new new-routing-mark=ISP1-route passthrough=yes src-address-list=route_to_ISP1 | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP1 - https://habrahabr.ru/post/313342/ - \E0\E4\F0\E5\F1\E0 \F7\E5\F0\E5\E7 \F3\EA\E0\E7\E0\ED\ED\FB\E9 \EC\E0\F0\F8\F0\F3\F2" connection-state=new dst-address-list=route_to_ISP1 new-routing-mark=ISP1-route passthrough=yes | |
/ip firewall mangle add action=mark-connection chain=forward comment="ISP1 - https://habrahabr.ru/post/313342/" in-interface=ISP1 new-connection-mark=ISP1-conn-f passthrough=no | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP2 - https://habrahabr.ru/post/313342/" connection-mark=ISP2-conn-f in-interface-list=!WAN new-routing-mark=ISP2-route | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP2 - https://habrahabr.ru/post/313342/ - \E0\E4\F0\E5\F1\E0 \F7\E5\F0\E5\E7 \F3\EA\E0\E7\E0\ED\ED\FB\E9 \EC\E0\F0\F8\F0\F3\F2" connection-state=new new-routing-mark=ISP2-route passthrough=yes src-address-list=route_to_ISP2 | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP2 - https://habrahabr.ru/post/313342/ - \E0\E4\F0\E5\F1\E0 \F7\E5\F0\E5\E7 \F3\EA\E0\E7\E0\ED\ED\FB\E9 \EC\E0\F0\F8\F0\F3\F2" connection-state=new dst-address-list=route_to_ISP2 new-routing-mark=ISP2-route passthrough=yes | |
/ip firewall mangle add action=mark-connection chain=forward comment="ISP2 - https://habrahabr.ru/post/313342/" in-interface=ISP2 new-connection-mark=ISP2-conn-f passthrough=no | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP3 - https://habrahabr.ru/post/313342/" connection-mark=ISP3-conn-f in-interface-list=!WAN new-routing-mark=ISP3-route | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP3 - https://habrahabr.ru/post/313342/ - \E0\E4\F0\E5\F1\E0 \F7\E5\F0\E5\E7 \F3\EA\E0\E7\E0\ED\ED\FB\E9 \EC\E0\F0\F8\F0\F3\F2" connection-state=new new-routing-mark=ISP3-route passthrough=yes src-address-list=route_to_ISP3 | |
/ip firewall mangle add action=mark-routing chain=prerouting comment="ISP3 - https://habrahabr.ru/post/313342/ - \E0\E4\F0\E5\F1\E0 \F7\E5\F0\E5\E7 \F3\EA\E0\E7\E0\ED\ED\FB\E9 \EC\E0\F0\F8\F0\F3\F2" connection-state=new dst-address-list=route_to_ISP3 new-routing-mark=ISP3-route passthrough=yes | |
/ip firewall mangle add action=mark-connection chain=forward comment="ISP3 - https://habrahabr.ru/post/313342/" in-interface=ISP3 new-connection-mark=ISP3-conn-f passthrough=no | |
/routing rule add action=lookup-only-in-table disabled=no interface=ISP1 routing-mark=ISP1-route table=ISP1-route | |
/routing rule add action=lookup-only-in-table disabled=no interface=ISP2 routing-mark=ISP2-route table=ISP2-route | |
/routing rule add action=lookup-only-in-table disabled=no interface=ISP3 routing-mark=ISP3-route table=ISP3-route |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment