Header Ads

Static Routing Configuration in MikroTik Router



Hello guys welcome to my personal blog, where I share my tutorials and experience from field work. Here I always hide most tedious and complex configurations for my blog lovers.
So today in this tutorial if you have being following me from the very beginning we are going to talk about static routing on mikrotik routers. But if you are new to mikrotik my advice is for you to go back for the very beginning and equip yourself with some basic mikrotik configurations and setups.
In IT carrier Static Routing is an important  to every network engineer who works with multiple MikroTik RouterOS and systems and if he or she also wants to connect among Router’s local networks.
A brief definition of Routing
Routing in general is a process used to find other networks which is not directly connected in the local router. 




Specifically, 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 hop 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.
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

No comments:

Theme images by Jason Morrow. Powered by Blogger.