A loopback interface can provide a stable interface on which you can assign a Layer 3 address . This address can be configured as the source address when the networking device needs to send data for protocols such as NetFlow,OSPF or Cisco Discovery Protocol (CDP) to another device in your network and you want the receiving device to always see the same source IP address from the networking device. This is an issue in networks with multiple equal-cost paths because under normal circumstances the packets that are generated by a networking device use the IP address from the outbound interface as the source address for the packets and because in a network with two or more equal-cost paths from the networking device to the receiving host each packet might use a different outbound interface.
There is no limit on the number of loopback interfaces you can create. Loopback interfaces do not have internal VLAN IDs or MAC addresses.
The Layer 2 switches like 3500xl or 2950, the loopback interface is not needed since these switches are not capable of routing between interfaces. The management vlan of the switch acts like the loopback interface since they are both logical interfaces.
When you have a Layer 3 switch, like a Catalyst 4500,6500,3550 or 3750, to configure loopback interface from the config mode, complete these steps:
Switch(config)#interface loopback 1
In order to remove the loopback interface, use the no interface loopback 1 in config mode.