Static Routing Configuration in MikroTik Router
Static Routing is an important topic to any network administrator who works with multiple MikroTik RouterOS and wants to establish communication among Router’s local networks. For example, say a network administrator maintains two MikroTik RouterOS connected with any communication medium and each RouterOS has its own networks and network resources such as servers, printers etc. and he wants that each network and network resources will be accessible from other networks. In this case, static routing configuration between two RouterOS will be a better solution. In this article, I will explain how to configure static routing between two MikroTik RouterOS so that each RouterOS networks will be accessible from other RouterOS networks. But before going to start our configuration, we need to be familiar with some basic routing topics which are necessary for static routing configuration.
Hops
In a Network, each layer 3 device endpoint (router) is called a HOP. In RIP and Static Routing concept, HOP is very important term to understand.
Routing
Routing is the process used to find other networks which is not directly connected in the local router. There are two types of routing.
- Static Routing is a process where route is manually generated in routing table. In static routing, the network administrator must know the next hope IP address or outgoing interface in which the network router is connected. Static route format: Route add Network Subnet {next hop IP address/ outgoing interface}. Mikrotik Example: /ip route> add dst-address=Network/Subnet gateway=Next Hop IP Address
- Dynamic Routing is a process of learning networks from different routers connected each other. Routers learn network by building neighbor relationship with adjacent router. Examples of dynamic routing are OSPF, EIGRP, RIP, BGP, and ISIS etc.
Static/Specific Routing Configuration
Now we will start static routing configuration in MikroTik Router. Our proposed network will be like below diagram.
There are two office networks in this diagram and each office network has a MikroTik RouterOS (R1 & R2). R1 Router is connected to WAN1 having IP address 192.168.110.2/28 and R2 Router is connected to WAN2 having IP address 192.168.10.2/30. R1 Router has its own LAN IP block (172.22.10.0/24) and R2 also has its own LAN IP block (172.22.20.0/24). Both Routers are connected with a communication medium having IP address 10.10.10.1/30 and 10.10.10.2/30 respectively. Now we will configure static routing in both RouterOS so that each LAN IP block can be accessible from other LAN IP block.
As there are two RouterOS (R1 & R2) in this diagram, we have to configure both RouterOS and now I will show this configuration from very beginning.
R1 Router Configuration
In R1 RouterOS, we will perform basic RouterOS configuration as well as static routing configuration. The following steps will show how to do MikroTik Router basic configuration and static routing configuration in R1 RouterOS.
- Login to R1 RouterOS using winbox and go to IP > Addresses. In Address List window, click on PLUS SIGN (+). In New Address window, put WAN IP address (192.168.110.2/28) in Address input field and choose WAN interface (ether1) from Interface dropdown menu and click Apply and OK button. Click on PLUS SIGN again and put LAN IP (172.22.10.1/24) in Address input field and choose LAN interface (ether2) from Interface dropdown menu and click on Apply and OK button. Again click on PLUS SIGN and put 10.10.10.1/30 (Gateway address for R2 to access LAN IP block) in Address input field and choose ether3 (RouterOS interface that is connected to R2) from Interface dropdown menu and click on Apply and OK button.
- Go to IP > DNS and put DNS servers IP (8.8.8.8 or 8.8.4.4) in Servers input field and click Apply and OK button.
- Go to IP > Firewall and click on NAT tab and then click on PLUS SIGN. Under General tab, choose srcnat from Chain dropdown menu and click on Action tab and then choose masquerade from Action dropdown menu. Click on Apply and OK button.
- Go to IP > Routes and click on PLUS SIGN (+). In New Route window, click on Gateway input field and put WAN Gateway address (192.168.110.1) in Gateway input field and click Apply and OK button.
- Static Routing means providing the destination IP Block and the Gateway address to reach that destination IP Block. As we want to reach R2 Router’s LAN IP Block (172.22.20.0/24) and according to network diagram the Gateway IP Address to reach this destination IP Block is 10.10.10.2, we will provide this information in R1 Router’s Routing table. For this, Go to IP > Routes and click on PLUS SIGN (+). In New Route window, put destination IP Block (172.22.20.0/24) in Dst. Address input field and put the Gateway address (10.10.10.2) in Gateway input field. Click Apply and OK button. If you have more LAN IP Blocks that you need to reach, you can add those IP Blocks according to this step.
Basic configuration and static routing configuration in R1 RouterOS has been completed and R1 Router is now ready to access R2 Router’s LAN IP Block. Now we will configure our R2 Router so that it can access R1 Router’s LAN IP Block.
R2 Router Configuration
Like R1 RouterOS, we will perform basic RouterOS configuration as well as static routing configuration in our R2 RouterOS. The following steps will show how to do MikroTik Router basic configuration and static routing configuration in R2 RouterOS.
- Login to R1 RouterOS using winbox and go to IP > Addresses. In Address List window, click on PLUS SIGN (+). In New Address window, put WAN IP address (192.168.10.2/30) in Address input field and choose WAN interface (ether1) from Interface dropdown menu and click Apply and OK button. Click on PLUS SIGN (+) again and put LAN IP (172.22.20.1/24) in Address input field and choose LAN interface (ether2) from Interface dropdown menu and click on Apply and OK button. Again click on PLUS SIGN (+) and put 10.10.10.2/30 (Gateway address for R1 to access LAN IP block) in Address input field and choose ether3 (RouterOS interface that is connected to R1) from Interface dropdown menu and click on Apply and OK button.
- Go to IP > DNS and put DNS servers IP (8.8.8.8 or 8.8.4.4) in Servers input field and click Apply and OK button.
- Go to IP > Firewall and click on NAT tab and then click on PLUS SIGN (+). Under General tab, choose srcnat from Chain dropdown menu and click on Action tab and then choose masquerade from Action dropdown menu. Click on Apply and OK button.
- Go to IP > Routes and click on PLUS SIGN (+). In New Route window, click on Gateway input field and put WAN Gateway address (192.168.10.1) in Gateway input field and click Apply and OK button.
- As we want to reach R1 Router’s LAN IP Block (172.22.20.0/24) and according to network diagram the Gateway IP Address to reach this destination IP Block is 10.10.10.1, we will provide this information in R2 Router’s Routing table. For this, Go to IP > Routes and click on PLUS SIGN (+). In New Route window, put destination IP Block (172.22.10.0/24) in Dst. Address input field and put the Gateway address (10.10.10.1) in Gateway input field. Click Apply and OK button. If you have more LAN IP Blocks that you need to reach, you can add those IP Blocks according to this step.
Basic configuration and static routing configuration in R2 RouterOS has been completed and R2 Router is now ready to access R1 Router’s LAN IP Block.
Now connect IP devices in both network and ping these devices. If everything is OK, you will be able to access both network successfully.
You will be able to configure static routing in MikroTik Router if you follow the above steps properly. However, if you face any confusion to do above steps, watch my video about MikroTik static routing configuration step by step. I hope, it will reduce your any confusion.
How to Configure Static Routing in MikroTik Router has been discussed in this article. I hope, you are now able to configure static routing in your network if required. However, if you face any problem to configure static routing in MikroTik Router, feel free to discuss in comment or contact with me from Contact page. I will try my best to stay with you.
Why not a Cup of COFFEE if the solution?
Static routing is simple one if you use one or two static routing. Follow my video also and do exact step. Hope it will work.
Thanks for the knowledge shared
excellent content, please keep it up