The loopback interface is the virtual interface that is always available and ready to be used, it is not mandatory that it will be tied with 127.0.0.1 it an interface like any other interface that could have its own IP addresses, but usually, we assign the 127.0.0.1 in IPV4 environment and::1 in ipv6 environment.
Usually, the loopback IP address range could be between 127.0.0.1 to 127.255.255.255.254 and you may use any IP addresses among this range to access the localhost.
Another common use of loopback address to identify the router, it can also be used in order to check the availability or router, for example, you want to find out either the router is up or down, it is possible that ping reached to that interface that was down, but it did not mean router was down at all, in order to avoid this confusion, we can use the loopback addresses.
A loopback interface is not physical interface like Fast Ethernet or Giga Ethernet rather it is the logical interface, In OSPF we use the loop-back IP address in order to identify the OSPF router-id, it allows BGP (border gateway protocol) neighborship to remain open if one of the outbound physical interface connected between them goes down. By default, a router does not have any loop-back interface later you may create them and assign the IP addresses accordingly.
Also, read…
In order to create a loopback interface, navigate to global configuration mode and run the command interface loopback number, by issuing this command loopback interface will be created automatically.
Once the interface has been created unlike other interfaces its state automatically goes to up, and you may assign the IP address as per guided below.
If we want to remove the loopback interface by using the no loopback loop a number as shown below.
The loopback interface is very useful in a testing environment and it’s not assigned to any physical port, for example, it could be used for testing internal routing process, A loopback interface is always enabled so there is no need to use no shutdown command in order to make it up.
In OSPF it is not mandatory that you specify the router-id, as OSPF requires the router ID’s to be unique in AS (Autonomous system), how over if loopback interface is configured the router will automatically take the loopback address as router-id, loopback interface can also be used to establish telnet session, ping the switch and to access the switch/router.
Download What is Loopback Interface in a Cisco Router? in pdf – Click here