Static routes and next hops

Today I have received a question by mail from one of our readers asking about the difference between pointing the static route to a next hop address or pointing it to the exit interface itself as shown in the example below:

!-- Pointing to next hop address
ip route 0.0.0.0 0.0.0.0 192.168.1.1
!-- or Pointing to the interface
ip route 0.0.0.0 0.0.0.0 s1/0

Although it seems to be an easy question to answer but I it was a little bit hard for me to write the answer in words. You know, sometimes we know things but when time comes for explaining them you do not know how to start. I decided to do it the following way, hope it is clear :)

To answer this question we just need to review some of the fundamentals:

Packet Forwarding

For a packet to be forwarded to its destination the router must determine the exit interface, rewrite the frame and put the packet on the wire.

What concerns us for our discussion is the frame rewriting part, in order for a router to write the frame it must resolve the IP address to its corresponding L2 address and reconstruct the frame before sending to the next hop.

The function of address resolution can be done dynamically using protocols like ARP or statically using adding static mappings in the address resolution tables.

Interfaces Media Types

In general interfaces can be point to point interfaces or multi-access interfaces, Ethernet is an example of multi-access interfaces. Frame-relay and ATM can act as a multi-access interface or point to point depending on the configuration.

Multiple access describes medias which multiple devices are connected and can send or receive simultaneously.

Point to Point describes medias where only two devices are connected to the same media and can only talk to each other.

Static Routes:

If the static route is pointed to a next hop address, the forwarding router needs to resolve the L2 address of this next-hop address only to rewrite the frame.

If the static route is pointed to the interface, the forwarding router still needs to resolve the L2 address to write the frame, but this time there is no next-hop address configured to go for; The router will try to find the L2 address of the destination by sending ARP request out of the interface to the destination address in case of Ethernet or looking for a static/dynamic map entry in the mapping table in case of frame-relay. It is clear that would never be a scalable solution.

One more point worth mentioning here is that a static route pointing to the next-hop rather than the outgoing interface is also known as a recursive static route, this came from the fact that the router will need to do recursive lookup(s) on the next-hop of the static route to find out the outgoing interface which the packets should be forwarded.

Conclusion:

I think it has been clear that the router's main function is to find the outgoing interface to reach the packets next hop in its path to the destination and to reach this next hop specifically it needs to find its L2 address "via address resolution protocols". From all the above sections we can safely conclude the following points:

  • For point to point interfaces, you can use static routes that point to the interface itself or to the next hop address. There is only one possible next hop and its L2 address will be used for the frame.
  • For multi-access interfaces, its more suitable to use static routes that point to a next hop address to avoid the need for resolving every destination address to its L2 address. It is still possible to use static routes pointing to the interface but it is not a scalable solution and requires additional configurations.

I have tried to make it clear as much as possible, hope I have been informative.

Check Also

Best AI tools list