Having created a loopback interface and assigned it to an IP address, we want to use it for management purposes, so it must be reachable from other routers and hosts. What we need to do is advertise the loopback’s prefix via our routing protocol(s). This requires “network” statements, interface commands, or route redistributions (“redistribute connected”), as appropriate. Of course, if we’re using non-default masks with our loopbacks (i.e., “/32”, as is typically done to conserve IP address space), any routing protocol advertising the loopback prefixes needs to be “classless”.
Speaking of addressing, from what address space are loopback addresses assigned? Since router management functions are usually accomplished “in-house”, loopback addresses are typically taken from RFC 1918 private address space, but if you want the loopbacks reachable from the outside world, their addresses can certainly be assigned from the organization’s public address space. In general, whether the addresses used are public or private, each individual loopback’s address should be unique within your organization (there are exceptions to this, such as PIM-SM “anycast” RP’s).
When advertising “/32” loopbacks via routing protocols that support automatic route summarization (RIPv2, EIGRP and BGP), if the loopback’s address is on a different classful network from those used on the interfaces and subinterfaces, auto summary should be disabled, so that the loopback’s actual prefix is advertised (and not its classful network). Of course, loopbacks within a region can be advertised as a summary block to other regions (between OSPF areas, for example).
Next question: Can we have more than one loopback on a single router? Absolutely! In fact, within reason, you can have as many loopbacks on a router as you want. You might have multiple loopbacks on a single router for different purposes, for example:
- Router identifiers (BGP, OSPF, LDP, MPLS-TE)
- Rendezvous points (Sparse-Mode PIM)
- General management (Ping, Telnet, SSH, SNMP, SDM, etc).
The first loopback created is commonly “Loopback0”, but since the range of available loopback numbers goes into the billions, you can use pretty much any numbers you want (“Loopback1”, “Loopback1001” or “Loopback1234567890”). Loopbacks do not need to go in sequential order, so you can have “Loopback 0”, “Loopback 10”, and “Loopback 99” on a router, if you like. Also, unlike IP addresses, loopback numbers are “locally significant”, so you can have a particular loopback number on as many routers as you want (for example, you can have a “Loopback0” on every router).
Aside from router management, another common use of loopbacks is to simulate networks for testing, in both production and lab environments. Unlike static routes, which can be advertised using routing protocols (“redistribute static”), but don’t “answer” to pings, Telnet or whatever, you could configure ten or twenty loopbacks with addresses and masks (not necessarily “/32”), and advertise them into the routing protocol(s). Not only would the loopback prefixes appear in routing tables, they would respond to IP utilities just like a “real” host.