[Policy Based Route 1] Mapping Paths with Route Rules

Mikrotik is a device that is quite flexible and we can set the configuration according to the needs of the existing network. Many kinds of features are added to the system, such as Firewall, Routing, Bandwidth Management, Web-Proxy, Samba Server, L2 Management, Hotspot, RADIUS functions, etc.
In addition, MikroTik products generally have several ethernet ports which by default each run independently, in other words, we can use it for more than one ISP Line by Loadbalance or Failover methods. Or you can also configure it with bridging mode for L2 Management needs.
In this article, we will try to configure the MikroTik router by using a 2-lane ISP connection. With these 2 ISP lines, we will make for example ‘ISP A’ only specifically for ‘Network A’ internet lines while ‘ISP B’ is exclusively for ‘Network B’ internet lines.
For the above needs we can later use ‘Policy Based Route’ and the feature we will use is Route Rules.
Network Topology

 

For topology, we will use as the picture above. For example in an ISP 2 subscription office, here we use ISP-1 and ISP-2. Then there are 2 LANs and each LAN will use a different ISP. Now for these needs, we can map connections using the “Route Rule” feature.

Configuration

The first step we need to do is “Basic-Config” on the Router, we can enable DHCP Client for each interface that leads to the internet. For the “Add Default Route” parameter, we can select “No”, because later we will create our own Routing rule.
DHCP Client
After successfully getting an IP address, the next step is to make an IP Address allocation for each LAN. For example, LAN-1 uses IP address 172.16.10.0/24, while LAN-2 uses IP address 172.16.20.0/24.
Address List

Add NAT with Out-Interface ether1 and ether2 with the “Masquerade” action so that clients can connect to the internet.

Firewall
Firewall

The next step is to configure the path mapping using “Route Rules”, Route Rules Menu, found on the IP menu> Route> Route Rules.

Route List
Route List
Configure it according to topology, we can describe the original address in “Src. Address” then select the “Lookup” action and in the Table parameters we can fill in “ISP-1”. Repeat the same steps for LANs with IP 172.16.20.0/24.
The next step we can make 2 Route rule with the destination to the internet (0.0.0.0/0) and use the gateway IP address according to the allocation of each ISP, we also need to specify the parameter “Routing Mark” to map LAN-A using ISP- A, and LAN-B uses ISP-B.

Testing Phase

The testing phase, we can try to do Traceroute via CMD on windows with the command “tracert“. We can see whether the path used is appropriate or not.

Note

For the above conditions, local traffic can indeed access the internet, for browsing and downloading can run for both LANs. But if you have the need for a Router connected to the internet for example for automatic backups or monitoring that requires a Router connected to the internet then you need to add a new Default Route. If we do a test with the conditions above, the router cannot connect to the internet, because for both default routes there are already “Routing Marks” from LAN 172.16.10.0/24 and 172.16.20.0/24.
So the Router can be connected to the internet, then we can add a new Default Route with the destination to the internet 0.0.0.0/0 and the gateway can choose one.
I hope it has been a useful article.