Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Configuring Loopback Interfaces

 

The topics below discuss the overview and configuration details of loopback interfaces on security devices.

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.

Configuring a Loopback Interface

The loopback interface supports many different network and operational functions and is an always-up interface. This means that the loopback interface ensures that the device is reachable, even if some of the physical interfaces are down or removed, or an IP address has changed. In most cases, you always define a loopback interface.

Junos OS follows the IP convention of identifying the loopback interface as lo0.

Junos OS requires that the loopback interface always be configured with a /32 network mask because the Routing Engine is essentially a host.

If you are using routing instances, you can configure the loopback interface for the default routing instance or for a specific routing instance. The following procedure adds the loopback interface to the default routing instance.

Optionally, instead of configuring the loopback interface at the [edit interfaces] hierarchy level, you can use a configuration group, as shown in this procedure. This is a recommended best practice for configuring the loopback interface. This procedure uses a group called global as an example.

To configure a loopback interface:

  1. Using the host IP address, assign it to the loopback interface.

    Each host in your network deployment should have a unique loopback interface address. The address used here is only an example.

  2. (Optional) Set the preferred IP address.

    You can configure as many addresses as you need on the lo0 interface, so it is good practice to designate one preferred IP address.

  3. (Optional) Configure additional addresses.

    Only unit 0 is permitted as the master loopback interface. If you want to add more IP addresses to unit 0, you configure them in the normal way under unit 0, without the preferred option.

    Note

    You do not have to include the /32 as long as the IPv4 address is a valid host address. (This usually means that the last octet cannot be zero.)

  4. Configure the localhost address.

    On the lo0.0 interface, it is useful to have the IP address 127.0.0.1 configured, as certain processes such as NTP and MPLS ping use this default host address. The 127.0.0.1/32 address is a Martian IP address (an address invalid for routing), so it is never advertised by the Juniper Networks device.

  5. (Optional) Configure an ISO address.

    Depending on your network configuration, you might also need an ISO address for the IS-IS routing protocol.

  6. If you used a configuration group, apply the configuration group, substituting global with the appropriate group name.
  7. Commit the configuration.