Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Configuring the Loopback Interface

On the router, you can configure one physical loopback interface, lo0, and one or more addresses on the interface.

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

[edit interfaces]lo0 {unit 0 {family inet {address loopback-address;address <loopback-address2>;...}family inet6 {address loopback-address;}}}

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 Configuration Guide.

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.

For more information about unnumbered interfaces, see Configuring an Unnumbered Interface. For more information about primary addresses, see Configuring the Interface Address.

Example: Configuring the Loopback Interface

Configure two addresses on the loopback interface with host routes:

[edit]user@host# edit interfaces lo0 unit 0 family inet[edit interfaces lo0 unit 0 family inet]user@host# set address 172.16.0.1 [edit interfaces lo0 unit 0 family inet]user@host# set address 10.0.0.1 [edit interfaces lo0 unit 0 family inet]user@host# top[edit]user@host# showinterfaces {lo0 {unit 0 {family inet {10.0.0.1;127.0.0.1;172.16.0.1;}}}}

Configure two addresses on the loopback interface with subnetwork routes:

[edit]user@host# edit interfaces lo0 unit 0 family inet[edit interfaces lo0 unit 0 family inet]user@host# set address 192.16.0.1/24 [edit interfaces lo0 unit 0 family inet]user@host# set address 10.2.0.1/16 [edit interfaces lo0 unit 0 family inet]user@host# top[edit]user@host# showinterfaces {lo0 {unit 0 {family inet {10.2.0.1/16;127.0.0.1/32;192.16.0.1/24;}}}}

Configure an IP and an IPv6 address on the loopback interface with subnetwork routes:

[edit]user@host# edit interfaces lo0 unit 0 family inet[edit interfaces lo0 unit 0 family inet]user@host# set address 192.16.0.1/24 [edit interfaces lo0 unit 0 family inet]user@host# up[edit interfaces lo0 unit 0 family]user@host# edit interfaces lo0 unit 0 family inet6[edit interfaces lo0 unit 0 family inet6]user@host# set address 3ffe::1:200:f8ff:fe75:50df/64 [edit interfaces lo0 unit 0 family inet6]user@host# top[edit]user@host# showinterfaces {lo0 {unit 0 {family inet {127.0.0.1/32;192.16.0.1/24;}family inet6 {3ffe::1:200:f8ff:fe75:50df/64;}}}}

Published: 2012-11-27

Published: 2012-11-27