The Loopback Interface

The loopback interface is a virtual interface that is always up and available after it has been configured. Note that the loopback interface is not tied to the address 127.0.0.1. It's an interface like any other, and can be assigned its own address. A loopback interface is often used as a termination address for some routing protocols, because it never goes down.

Another common use of a loopback address is to identify a router. For example, say you want to find out whether a particular router is up. You know that the router has an ethernet0 interface with an IP address of 10.10.1.1. You ping 10.10.1.1 and don't get a response. Does this mean your router is down? It's possible that the router is up and that the ping reached the router on another interface, but you didn't receive a response because ethernet0 is down. To find out unambiguously whether the router is alive, you have to ping another interface. But that interface might be down, causing the same scenario to occur. To avoid this problem, you can configure the router's loopback interface with a unique address. Then, when you want to telnet or ping your router, use the loopback interface's IP address. This method ensures that you will get a response no matter how your packets reach the router.

Here's how to assign an IP address to a loopback interface :

interface loopback 0 ip address 10.10.1.2 255.255.255.255

Other ways to use the loopback interface include:

  1. Using the unnumbered command on serial links mixed with the loopback interface to eliminate wasted IP addresses on serial links.
  2. Various routing protocols, such as OSPF and BGP, make use of a router ID , which should be the address of a link that is always up. The loopback interface is great for this purpose. (OSPF and BGP are discussed in Chapters 9 and 10, respectively.)
  3. Use the address of a loopback interface as the IP address for all management software. The management software will test whether the router is alive by pinging the loopback interface's IP address.

Категории