Mikrotik’s Interface Routing Option

Over the course of the past several days, I have seen a significant number of folks who misunderstand the proper use for the new interface based routing option in MikroTik's RouterOS. First, what is interface routing anyway?  In order to understand the answer to this question, we first have to understand how network communications works.  More specifically, we will discuss how IP communications happens.

Consider the following network:

Let's begin with a packet that is coming into our network on the Router A interface that faces the "upstream router".  In order for the upstream router to know that it needs to deliver the packet to our Router A, it will look at the IP header in the packet and determine that the destination is (for example) 10.20.20.3.  Since the upstream router has a route that says "deliver packets to destination 10.20.20.0/24 via the T1 to Router A", it will send the packet out the serial interface.  It can do this because a T1 and other similar transport technologies are SINGLE ACCESS technologies.  In other words, these are non-broadcast networks, because there are only 2 devices possible on this network.  Because of this, I don't need to broadcast in order to determine a physical address to deliver the packet to.

In Mikrotik the routing configuration looks like this:

/ip route add dst-address=10.20.20.0/24 gateway="T1_port"

This causes the port (named T1_port) to be used as the gateway to the 10.20.20.0/24 network as described above.  To continue our discussion of the packet described above, once the Router A router has the packet, it is responsible to deliver that packet to either the next hop (next router) OR to the final destination.  Since the 10.20.20.0/24 network is local to Router A, it must determine how to deliver the packet to the PC.

Unlike the T1 type interface, the ethernet segment is a "multiple access" type of network.  By this, I mean ethernet enables a network where multiple devices can exist.  Because of this, the IP suite of utilities includes a function called ARP (which stands for "Address Resolution Protocol").  The purpose of the ARP function is to determine the physical address associated with a given IP address.  ARP is implemented by the "asking" device (Router A in our example) sending a broadcast packet to the network that asks a question.  The question is something like "Who has 10.20.20.3?".  Because the device with that IP exists on the switch, that PC will answer and send a reply back to the MAC address (ARP operates at layer 2) of the asking device that looks something like "10.20.20.3 is at XX:XX:XX:XX:XX" where "XX:XX:XX:XX:XX" is the MAC address of the PC's interface connected to the switch.  At this point, Router A just wraps the IP packet (with destination IP of 10.20.20.3) in an ethernet packet (because that's what type of network we are "speaking" on) and sends it out the interface.

While I will go into a bit more detail in another article on some of the reasons for the decisions the routers made above, it is important to note that the primary difference between the T1 (single access) and ethernet (multiple access) segments is the number of possible "remote" devices on the network. There are other single access networks that Mikrotik supports.  These include pppoe, PPtP, and L2TP tunnels.

SO...I was going to talk about Mikrotik's new option to add an interface when adding a route.  If the network type where a packet is going to be routed is one of the above "single access" network types, then you can enter an interface name instead of a gateway IP address.  Some examples in common use in Mikrotik that are "single access" networks include T1, PPPoE, PPtP and L2TP interfaces.  If the network type is a multiple access type network, such as ethernet, wireless or other "broadcast network" topologies, then you MUST enter an IP address INSTEAD OF AN INTERFACE in the route statement.

I hope this article has been helpful.  I will be adding the article on routing over the next few days, which should be a big help in understanding some of the decisions made by the routers in my example.  Until then, be well.

Leave a Reply

You must be logged in to post a comment.