Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Loopback Interfaces

This topic discusses about the use of loopback interface, step-by-step procedure on how to configure loopback interfaces with examples.

Understanding the Loopback Interface

The Internet Protocol (IP) specifies a loopback network with the (IPv4) address 127.0.0.0/8. Most IP implementations support a loopback interface (lo0) to represent the loopback facility. Any traffic that a computer program sends on the loopback network is addressed to the same computer. The most commonly used IP address on the loopback network is 127.0.0.1 for IPv4 and ::1 for IPv6. The standard domain name for the address is localhost.

A network device also includes an internal loopback address (lo0.16384). The internal loopback address is a particular instance of the loopback address with the logical unit number 16384.

The loopback interface is used to identify the device. While any interface address can be used to determine if the device is online, the loopback address is the preferred method. Whereas interfaces might be removed or addresses changed based on network topology changes, the loopback address never changes.

When you ping an individual interface address, the results do not always indicate the health of the device. For example, a subnet mismatch in the configuration of two endpoints on a point-to-point link makes the link appear to be inoperable. Pinging the interface to determine whether the device is online provides a misleading result. An interface might be unavailable because of a problem unrelated to the device's configuration or operation. You can use the loopback interface to address these issues.

Benefits of Loopback Interface

  • As the loopback address never changes, it is the best way to identify a device in the network.

  • The loopback interface is always up and it is reachable as long as the route to that IP address is available in the IP routing table. Hence you can use the loopback interface for diagnostics and troubleshooting purposes.

  • Protocols such as OSPF use the loopback address to determine protocol-specific properties for the device or network. Further, some commands such as ping mpls require a loopback address to function correctly.

  • You can apply stateless firewall filters to the loopback address to filter packets originating from, or destined for, the Routing Engine.

  • Junos OS creates the loopback interface for the internal routing instance, which prevents any filter on lo0.0 from disrupting internal traffic.

Loopback Interface Configuration

Configuring the Loopback Interface

When specifying the loopback address, do not include a destination prefix. Also, in most cases, do not specify a loopback address on any unit other than unit 0.

Note:

For Layer 3 virtual private networks (VPNs), you can configure multiple logical units for the loopback interface. This allows you to configure a logical loopback interface for each virtual routing and forwarding (VRF) routing instance. For more information, see the Junos OS VPNs Library for Routing Devices.

For some applications, such as SSL for Junos XML protocol, the address for the interface lo0.0 must be 127.0.0.1.

You can configure loopback interfaces using a subnetwork address for both inet and inet6 address families. Many protocols require a subnetwork address as their source address. Configuring a subnetwork loopback address as a donor interface enables these protocols to run on unnumbered interfaces.

If you configure the loopback interface, it is automatically used for unnumbered interfaces. If you do not configure the loopback interface, the router chooses the first interface to come online as the default. If you configure more than one address on the loopback interface, we recommend that you configure one to be the primary address to ensure that it is selected for use with unnumbered interfaces. By default, the primary address is used as the source address when packets originate from the interface.

On the router, you can configure the physical loopback interface, lo0, and one or more addresses on the interface. You can configure more than just unit 0 for lo0, but each additional unit needs to be applied somewhere other than the main instance.

To configure the physical loopback interface, include the following statements at the [edit interfaces] hierarchy level:

Example: Configuring Two Addresses on the Loopback Interface with Host Routes

To configure two addresses on the loopback interface with host routes:

Example: Configuring Two Addresses on the Loopback Interface with Subnetwork Routes

To configure two addresses on the loopback interface with subnetwork routes:

Example: Configuring an IPv4 and an IPv6 Address on the Loopback Interface with Subnetwork Routes

To configure an IPv4 and an IPv6 address on the loopback interface with subnetwork routes: