A couple of months ago while studying for my CCNA exam someone asked a question:

What role do the loopback interfaces play during the routing process? What is a loopback anyway and what does it do?

Most of the time we use physical interfaces in a networking device either for a frame or packet forwarding, sometimes logical interfaces or even subinterfaces( ie. port channels, tunnels, loopbacks) while these are used for advanced networking some people barely know what the loopback interface does.

People sometimes refer to a loopback as the “my computer’s IP address” or “127.0.0.1” “localhost” while this is true, we must know what is the behind context of that ip.

When you configure a device let’s call it a switch, router, pc or any interconnecting device we normally have more than 1 physical interface and they could have 2 states (up or down) UP for when there is a cable plugged and we have link with the other side of that connection and DOWN when there is no cable connected or it’s administratively down (shut down by the admin). Some logical interfaces like tunnels or port channels are attached to one or many physical interfaces meaning that if we lose connectivity with them they can be shut down, but there are other like loopbacks where they are not attached to any physical interface and once created they remain up no matter if all physical interfaces go down, it will always remain up.

A loopback interface is set normally for administrative purposes in the routing processes, some internal gateway protocols like EIGRP or OSPF will use them to establish adjacency between the neighbors because they usually prefer this interface rather than a physical because it’s a best practice (they will always remain up).

The order in what the routing protocol OSPF elects a DR and BDR is the highest router ID is the following:

  • Manually assigned Router ID
  • Highest Loopback interface
  • Highest ip configured of any interface

 

Imagine that each packet you send to the ip address configured in a loopback interface will be sent to the device itself, it’s a way to test the health of your device and make sure it’s reachable. Another use is creating testing networks and monitoring tools.