Loopback interfaces

This section describes how to configure and use user-defined loopback interfaces on the switch.


[NOTE: ]

NOTE: The interface loopback command is not support by HP Switch 2530 (J9772A–J9783A) products.


Introduction

By default, each switch has an internal loopback interface (lo0) with the IP address 127.0.0.1. This IP address is used only for internal traffic transmitted within the switch and is not used in packet headers in egress traffic sent to network devices.

You can configure up to seven other loopback interfaces (lo1, lo2, lo3, and so on) on the switch to use to transmit network across the network. Each loopback interface can have multiple IP addresses. Routing protocols, such as RIP and OSPF, advertise the configured loopback addresses throughout a network or autonomous system.

User-defined loopback addresses provide the following benefits:

  • A loopback interface is a virtual interface that is always up and reachable as long as at least one of the IP interfaces on the switch is operational. As a result, a loopback interface is useful for debugging tasks since its IP address can always be pinged if any other switch interface is up.

  • You can use a loopback interface to establish a Telnet session, ping the switch, and access the switch through SNMP, SSH, and HTTP (WebAgent).

  • A loopback IP address can be used by routing protocols. For example, you can configure the loopback IP address as the router ID used to identify the switch in an OSPF area. Because the loopback interface is always up, you ensure that the switch's router ID remains constant and that the OSPF network is protected from changes caused by downed interfaces.


[NOTE: ]

NOTE: OSPF does not require that you use an IP address as the router ID. OSPF only requires the router ID to be a unique value within the autonomous system (AS). However, if you configure the loopback IP address as the router ID, OSPF can reach the switch if any switch interface is up. (Normally, OSPF automatically configures the router ID with the IP address of a switch interface. The disadvantage is that if the interface goes down, OSPF can no longer ping the switch using the router ID even if other interfaces are operational.)

For more information about how to configure a loopback IP address to participate in an OSPF broadcast area, See the section titled "(Optional) Assigning Loopback Addresses to an Area" in the Multicast and Routing Guide.


Configuring a loopback interface


[NOTE: ]

NOTE: The interface loopback command is not support by HP Switch 2530 (J9772A–J9783A) products.


To configure a loopback interface, enter the interface loopback command at the global configuration level of the CLI:

Syntax

[no] interface loopback <number>

Creates a loopback interface, where <number> is a value from 1 to 7. Use the no form of the command to remove the loopback interface.

Note: You cannot remove the default loopback interface (number 0) with IP address 127.0.0.1.

You can configure up to thirty-two IP addresses on a loopback interface. To configure an IP address for the loopback interface, enter the ip address <ip address> command at the loopback interface configuration level as shown in the following example.

Note that when you configure an IP address for a loopback interface, you do not specify a network mask. The default subnet mask 255.255.255.255 is used.

A loopback interface configuration

HP Switch(config)# interface loopback 1
HP Switch(config)# ip address 10.1.1.1

[NOTE: ]

NOTE:

  • You can configure a loopback interface only from the CLI; you cannot configure a loopback interface from the WebAgent or Menu interface.

  • Loopback interfaces share the same IP address space with VLAN configurations. The maximum number of IP addresses supported on a switch is 2048, which includes all IP addresses configured for both VLANs and loopback interfaces (except for the default loopback IP address 127.0.0.1).

  • Each IP address that you configure on a loopback interface must be unique in the switch. This means that the address cannot be used by a VLAN interface or another loopback interface.

  • For example, if you configure a VLAN with IP address 172.16.100.8/24, you cannot configure a loopback interface with IP address 172.16.100.8. In the same way, if you configure a loopback interface (lo1) with IP address 172.16.101.8, you cannot configure another loopback interface (lo2) with IP address 172.16.101.8.

  • You can configure multiple IP addresses on a loopback interface (lo0 to lo7). Up to thirty-two IP addresses are supported on a loopback interface. The following example shows valid IP address configurations on two loopback interfaces.

Two loopback interfaces

HP Switch(config)# interface loopback 0
HP Switch(lo0)# ip address 172.16.101.8
HP Switch(lo0)# ip address 172.16.101.9
HP Switch(lo0)# exit
HP Switch(config)# interface loopback 1
HP Switch(lol)# ip address 172.16.102.1
HP Switch(lol)# ip address 172.16.102.2



Displaying loopback interface configurations

To display the list of loopback interfaces which have been assigned IP addresses, enter the show ip command.

In the show ip command output, information about configured loopback interfaces is displayed below other IP configuration parameters, such as packet TTL and ARP age-out values, and VLAN IP configurations. The following example displays the IP addresses configured for two user-defined loopback interfaces (lo1) and (lo2).

The show ip command output

HP Switch# show ip

 IP Routing : Enabled

   Default Gateway : 15.255.128.1
   Default TTL     : 64
   Arp Age         : 20
   Domain Suffix   :
   DNS server      : 

                    |                                           Proxy ARP
   VLAN             | IP Config  IP Address      Subnet Mask    Std Local
   ---------------- + ---------- --------------- -------------- ----------
   DEFAULT_VLAN     | Manual     10.0.8.121     255.255.0.0     No   No
   VLAN2              Manual     192.168.12.1   255.255.255.0   No   No
   VLAN3              Disabled


                           Loopback Addresses
   Loopback   IP Config    IP Address           Subnet Mask
   --------   ----------   ------------------   ---------------
   lol        Manual       172.16.110.2         255.255.255.255 
   lo2        Manual       172.16.112.2         255.255.255.255 
   lo2        Manual       172.16.114.1         255.255.255.255

[NOTE: ]

NOTE: The default loopback interface (lo0) with IP address 127.0.0.1 is not displayed in the show ip command output because it is permanently configured on the switch. To display the default loopback address, enter theshow ip route command as shown in the example below.


To display the loopback interfaces configured on the switch in a list of IP routing entries displayed according to destination IP address, enter the show ip route command.

The following example displays the configuration of the default loopback interface (lo0) and one user-defined loopback interface (lo2).

The show ip route command output

HP Switch# show ip route

                                IP Route Entries

Destination        Gateway         VLAN Type      Sub-Type   Metric    Dist.
------------------ --------------- ---- --------- ---------- --------- ----
10.0.0.0/16        DEFAULT_VLAN    1    connected             1         0
127.0.0.0/8        reject               static                0         0
127.0.0.1/32       lo0                  connected             1         0
172.16.10.121/32   lo2                  static                1         0
172.16.100.0/24    10.0.8.11       1    ospf       IntraArea  1         1
172.16.102.0/24    VLAN2           2    connected             1         0