In output of ifconfig:

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1552397  bytes 88437726 (88.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1552397  bytes 88437726 (88.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

netmask indicate the network is, and consists many IP addresses

prefixlen 128 indicates the network has just one IP address. (https://networkengineering.stackexchange.com/a/57868/7894 seems to me that prefixlen specifies a network mask for IPv6)

Do they describe the same network?

Is a network defined as a set of IP addresses (therefore difference between IPv4 and IPv6 addresses can lead to different networks), or a set of network interfaces (therefore IPv4 and IPv6 addresses won't make difference, since they are assigned to the same network interfaces)?

  • 1
    Don’t think of loopback as a network, you’ll only end up confused. – Stephen Kitt Mar 22 at 13:42
  • 2
    On the other hand, Tim could just as well have asked this about a real network interface, so loopback being or not being a network is a bit of a red herring. I have a machine with a vio0 interface that has a /32 IP4 address and a /56 IP6 address about which Tim could ask the same question. – JdeBP Mar 22 at 13:50
  • the prefixlen refers to the ipv6 ::1 loopback, not to the ipv4 They're xompletely different things. – mosvy Mar 22 at 13:59
  • @mosvy "the prefixlen refers to the ipv6 ::1 loopback," do you mean prefixlen always specifies the current network interface, instead of a network? networkengineering.stackexchange.com/a/57868/7894 seems to me that prefixlen specifies a network mask for IPv6 – Tim Mar 22 at 14:35
  • No. It specifies the length of the network part of an address, which for ::1/128 is 128. For the ipv4 with network mask the prefix length is 8. ipv4 and ipv6 are different protocols, so I don't see how the question whether an ipv4 and an ipv6 address can be part of the same network makes any sense. – mosvy Mar 22 at 14:44

It depends on which abstraction layer you're looking at.

If we look at L3 of the OSI model, the IPv6 and IPv4 sides of the loopback interface are completely separate: there is no routing functionality between the two (unless you explicitly set it up). There is an optional (enabled by default, but switchable per socket) mapping of the entire IPv4 address space to a subset of the IPv6 address space, but you need to be at L4 or above to make use of it.

On an actual physical NIC, we could also look at L2 and the physical layer, and see that both L3 protocols are actually sharing the same Ethernet media and MAC addresses, and are therefore "the same network" in L2 sense. But a loopback interface does not have a L2 layer, let alone a physical layer.

Fundamentally, the loopback interface is a shortcut at the L3 level from the outgoing side of the IP (either IPv4 or IPv6) driver stack to the incoming side. When an application wants to communicate with another application using the network protocols, and both applications happen to be in the same host, the loopback interface allows the traffic between them to be routed more efficiently, without unnecessarily passing back & forth through the entire depth of the network protocol stack.

Sometimes applications want to allow some traffic only within the single host, or only on a specific physical NIC: for this purpose, it is useful to have the host-internal shortcut be presented as a L3 network interface, so the higher-level protocols can just use it like any other network interface without needing to implement a special case.

  • Is it really routing though? Or is it a sort of mapping in the interface between L3 and L4? I don't think I can make an IPv6 routing table entry and have it affect where the system routes IPv4 packets. Also, applications can opt out of the mapping by using the IPV6_V6ONLY socket option, and the administrator can set the system-wide default by using /proc/sys/net/ipv6/bindv6only. – telcoM Mar 22 at 17:02
  • I just wanna ask why do people analize the network strusture using OSI model. It's not used in the real world. Such answers are too unfriendly. – 炸鱼薯条德里克 Mar 23 at 5:10

Q: Is a network defined as a set of IP addresses (...), or a set of network interfaces (...) ?

My opinions:

You cannot really define a network in terms of IPv6 addresses. The concept "a set of network interfaces" is more useful. See the definition of "link" below.

This precise definition for "network" might not be widely agreed enough. So it might not be a useful term in your question.

This differs from working with IPv4. In the IPv4 world, the term "subnet" was more common and useful.

My reasoning:

RFC 8200 starts with an introduction, and then definitions of 11 key terms. They do not include "network", but they do include "link".

link: a communication facility or medium over which nodes can communicate at the link layer, i.e., the layer immediately below IPv6. Examples are Ethernets (simple or bridged); [...]

interface: a node's attachment to a link.

All interfaces share the exact same prefix for link-local unicast addresses: fe80::/10. Different hosts on different links can use the same link-local address. At a user level, you have to specify which link you want, by including an interface specifier. E.g. ping fe80::1234%lo .

Link-local addresses can be ignored in many cases. However they are an essential part of how IPv6 works:

When you run a standard IPv6 Local Area Network through an L2 Ethernet "switch" (or switches), the routable unicast addresses have to be resolved using Neighbour Discovery packets. ND packets are are sent using link-local addresses. [1]


  • The ip link command is for "network device configuration". In other words, the command "ip link" is actually used to configure interfaces :-).

  • A "loopback interface" like lo is contrived by the operating system. The IPv6 standards say that ::1 may be assigned to

    a virtual interface (typically called the "loopback interface") to an imaginary link that goes nowhere.

    It does not tell you exactly how this will be implemented e.g. in Linux. I think there are some weird questions you can ask about this, but the answers do not really tell you very much.

  • You can still get away with thinking in IPv4 terms a lot of the time. But IPv6 adoption is increasing. It is good to at least try to learn IPv6 equivalents, when you are learning about specific IPv4 features. Realistically, you will probably see some terms used for IPv4, and some different terms used for IPv6. You will not always know a generic definition that can account for both IPv4 and IPv6.

  • [1] Neighbour discovery actually uses both unicast and multicast link-local addresses. E.g. ND requests are usually sent from a unicast address, to a multicast address. Link-local multicast addresses are perhaps not as simple as the unicast ones. They are the multicast addresses where the "scop" part is set to link-local.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.