0

I've been reading through many forums and many questions here on loopback interfaces and a point that is constantly iterated is that a loopback interface is a virtual interface.

In hypervisors like vmware and hyper-v, there is a virtual switch. Does this mean every interface of this virtual switch is a loopback interface? What about virtual interfaces created by VPNs? Can these be called loopback too?

What about creating interfaces in /etc/network/interfaces on linux machines? Can these be considered loopback too?

Jeff Wheeler
  • 113
  • 4
rsn
  • 103
  • 4

4 Answers4

3

I guess you are moving a little bit too fast and mixing the terms a little.

To go over the basic meaning and utility of the loopback interface (from https://en.wikipedia.org/wiki/Loopback#Virtual_loopback_interface)

Implementations of the Internet protocol suite include a virtual network interface through which network applications can communicate when executing on the same machine. It is implemented entirely within the operating system's networking software and passes no packets to any network interface controller. Any traffic that a computer program sends to a loopback IP address is simply and immediately passed back up the network software stack as if it had been received from another device.

So from my point of view, the main purpose of the loopback interface(s) is to have an easy way to test the network stack of your system. If you have 2 applications running on the same system and you want to test if they can communicate with each other via the network, you won't need a router/switch (or whatever else would constitute the network), you just use software and a couple of commands to create some loopback interfaces and you route traffic through those.

The IPv4 address block 127.0.0.0/8 is actually reserved for this reason and usually the 'localhost' points to an address from that range. So pinging/sending traffic to 'localhost' is actually done using a loopback interface.

In networking

Also, (from https://en.wikipedia.org/wiki/Loopback#Management_interface), you can see that the use for a loopback interface can actually be different in some cases, as in Networking (and networking devices as router/switches/firewalls, etc.) is mostly used as a management interface. It is also used by various routing protocols and other services.

Networking devices do have software installed on them, just like an operating system, and can create multiple types of virtual interfaces, among them being the loopback. But there are other types of virtual interfaces, that have a different purpose (not for testing the network stack and sending traffic back or management), like the tunnel interfaces usually used for VPNs. Bridge interfaces are virtual interfaces as well.

In the end, all of these virtual interfaces are created with software (and they basically modify/change the network packets that you send/receive - source IP, source MAC etc.) and they do in fact use the physical interfaces to communicate over a network.

To conclude and to answer your questions, (almost) all loopback interfaces (check Spooler's comment of this post) are virtual interfaces, but not all virtual interfaces are (=have the purpose of) loopback interfaces.

Does this mean every interface of this virtual switch is a loopback interface?

No. The virtual switch could have a loopback interface, but all of its other interfaces probably simulate the behavior of a normal physical interface, that just sends the traffic to another interface to which is connected via a medium (cable, radio, etc.) which in this case is probably just software.

What about virtual interfaces created by VPNs? Can these be called loopback too?

No. VPNs usually use another type of virtual interface - a tunnel interface.

Alex andru
  • 51
  • 3
  • Not all loopback interfaces are virtual. Hardware implementations of loopback interfaces are absolutely a thing, and virtual loopback interfaces are designed to emulate their behavior. In many cases, a hardware loopback interface is a literal crossing of receive and transmit lines. Sometimes, it's a device that retransmits in more complex scenarios (such as fiber, or multiplexed base-t). These devices are often used to test a physical port or fabric, rather than just the software network stack of a single node. They are often included in cable testers and the like. – Spooler Dec 08 '20 at 20:03
  • Yea, I guess you are right. I knew about cable testers and such, but I never thought about them as being loopback interfaces, although that is kind of their use-case definition. Edited my response. – Alex andru Dec 10 '20 at 10:06
1

The most important property of loopback interfaces is they are always up regardless of the state of other interfaces in the system. A loopback can only be down if you configure it to be down.

Virtual interfaces is a reasonable description, but one that might have a lot of semantic overlap with other types of interfaces.

I wouldn't describe vmware virtual switch interfaces as loopbacks. These interfaces may be down for a variety of operational status reasons, right? They also have a different purpose than loopbacks -- which are explicitly to provide an interface that is always up.

Jeff Wheeler
  • 113
  • 4
0

A virtual interface is one which is not (immediately) represented by some hardware. In this sense loopback interfaces are virtual interfaces. (But there are other virtual interfaces too :-))

A loopback interface doesn't require any hardware and keeps the traffic completely on the system. This is useful/necessary because a great lot of programs communicate via network protocols - even on the same system. And we don't want to feed "internal" communications into the real network.

guntbert
  • 631
  • 9
  • 21
0

A loopback interace is "virtual" in the original meaning of the word, i.e. that it's not linked to any physical hardware.

But nowadays the word "virtual" is mainly used when talking about hypervisors, and the original meaning of "existing only in software" got almost lost.

From a technical POV, a loopback interface and a virtual network adapter are two completely different things; but both are treated by the OS as if they were "true" network interfaces; a VPN tunnel also gets the same treatment.

After all, you can encapsulate network protocols in any kind of interface you can think of.

Massimo
  • 70,200
  • 57
  • 200
  • 323