Assigning an IP address to a loopback interface

Loopback interfaces can be assigned an IPv4 address using this task.

Loopback interfaces are always up, regardless of the states of physical interfaces. They can add stability to the network because they are not subject to route flap problems that can occur due to unstable links between a Layer 3 switch and other devices. You can configure up to eight loopback interfaces on a chassis Layer 3 switch devices. You can configure up to four loopback interfaces on a compact Layer 3 switch.

Note: If you configure a Layer 3 device to use a loopback interface to communicate with a BGP4 neighbor, you also must configure a loopback interface on the neighbor and configure the neighbor to use that loopback interface to communicate with the Layer 3 device.
  1. Enter the show default values command to view the maximum number of IP addresses you can assign to a loopback interface for the current device.
    device# show default values
    
    sys log buffers:50  mac age time:300 sec   telnet sessions:5
    ip arp age:10 min   bootp relay max hops:4 ip ttl:64 hops
    ip addr per intf:24
    (output truncated)
    From the output, this device can support up to 24 IP addresses added to each loopback interface.
  2. Enter global configuration mode.
    device# configure terminal
  3. Enter interface configuration mode and specify a loopback interface.
    device(config)# interface loopback 1
  4. Assign an IP address to the loopback interface.
    device(configconfig-lbif-1)# ip address 10.0.0.1/24
  5. Enter the show ip interface command to display IP interface information.
    device(config-lbif-1)# show ip interface
    
    Interface         IP-Address      OK?  Method    Status            Protocol
    Ethernet 1/1/1    10.95.6.173     YES  NVRAM     up                up
    Ethernet 1/1/2    10.3.3.3        YES  manual    up                up
    Loopback 1        10.0.0.1        YES  NVRAM     up                up

The following example assigns an IP address to a loopback interface.

device# configure terminal
device(config)# interface loopback 1
device(config-lbif-1)# ip address 10.0.0.1/24