A
A
Andrew2016-10-01 01:21:09
Mikrotik
Andrew, 2016-10-01 01:21:09

2 WAN, 2 LAN split and switch Mikrotik?

Hello colleagues! Help solve the problem!
There is such a scheme
Mikrotik router 5 ports + wi-fi and 2 providers ISP1 and ISP2
ether1 - ISP1
ether2,3,4 - LAN1 DHCP 192.168.1.0/24
ether5 - ISP2
wlan1 (wi-fi) - LAN2 DHCP 192.168.88.0/24
1. It is necessary to make sure that LAN1 goes to the Internet through ISP1, and wi-fi LAN2 goes through ISP2.
2. In case of ISP1 failure, the LAN1 mesh began to go through ISP2 and vice versa in case of ISP2 failure, LAN 2 started to go through ISP1.
Is it possible to solve this problem without scripts?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
H
HawK, 2016-10-05
@HawK3D

Your task with the help of RouterOS is solved very simply without the use of scripts.
In the settings of the ISP interfaces, you need to remove the auto-assignment of the default route (add default route), instead of them, manually create default routes with routing marks (routing mark). For the route to ISP1, the label can be omitted (by default, the label "main" is used, which is not displayed). For the ISP2 route, for example, specify routing mark = isp2.
In order for LAN2 traffic to go through the route with the isp2 label, you need to add a routing rule:
/ip route rule
add action=lookup disabled=no src-address=192.168.88.0/24 table=isp2.
To reserve the ISP2 link for LAN1, add another default route, specifying the ISP2 gateway as the gateway and specifying the distance value greater than in the main routes (by default, distance=1). To reserve ISP1 for LAN2, no additional settings are needed, traffic will go through the main route by default, if the route is unavailable for the label specified in /ip route rules.
These settings are enough to solve your problem, but the reservation will only work if the corresponding gateway is unavailable. For a deeper check of the channel for Internet availability, set up recursive routing, this is described in detail in Alexander Romanov's presentation .
Appropriate masquerading rules must also be configured in /ip firewall nat.

O
Obsession, 2016-10-03
@Obsession

Isn't it easier like this:
lan1 192.168.1.0/24
lan2 192.168.88.0/24
wan1 DHCP (doesn't matter)
wan2 DHCP (yes, it doesn't matter)
for the first network:
for the second:
and without scripts it's better not to try, with scripts it's much easier

M
Maxim Moseychuk, 2016-10-01
@fshp

Set up dynamic routing with manual metrics for each external link. But this requires Metarouter to raise several routers. Or use failover

M
Melkij, 2016-10-01
@melkij

Or conntrack instead of routing by source.
Look in my old question: Mikrotik, choosing a preferred gateway based on Address Lists , according to your needs address-list wan_failover_prefer_gw*
This scheme supports automatic failover, but without scripting, I still didn’t light up how it works. Something like this: https://habrahabr.ru/post/141785/#comment_4742281 (link to the comment)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question