1

Are docker0, lo and virbr0 are virtual network interfaces?

Why are docker0 and virbr0 assigned private not loopback IP address?

If private IP address can work like a loopback address, can lo be assigned a prviate instead of loopback IP address?

Loopback addresses are 127.*.*.*. Do they always form a network instead of being split into several smaller networks, as in the example?

192.168.*.* is a range of private IP addresses. Are they often split into several smaller networks, as in the example (wlx8 and virbr0)?

Thanks.

$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:a6:79:a6:bc  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        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

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:b1:aa:1f  txqueuelen 1000  (Ethernet)
        RX packets 123  bytes 12102 (12.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 39  bytes 4300 (4.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlx8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.97  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a0df:c436:afb1:8b45  prefixlen 64  scopeid 0x20<link>
        ether   txqueuelen 1000  (Ethernet)
        RX packets 991338  bytes 536052615 (536.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 618233  bytes 101520924 (101.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • The private addresses do not work the same as loopback adresses. A packet sent to a private address is not looped back. A rfc1918 ("private") address is simply an adress from a blocks reserved for use "inside an organization", but with the ipv4 address shortage, more and more clients are only assigned such addresses by ISPs, which are then using some form of NAT to let them use the Internet. – Uncle Billy Mar 22 at 13:16
4

What constitutes a “network” (a set of endpoints which are reachable without the help of routers) is determined by the netmask here. Thus docker0 is on the 172.17.x.x network (and can talk to any 172.17.x.x endpoint in the same layer 2 network), lo is on the 127.x.x.x network, virbr0 is on the 192.168.122.x network (and can talk to any 192.168.122.x endpoint in the same layer 2 network), and wlx8 is on the 192.168.1.x network (I’ll let you fill in), and they’re all separate. The loopback network is special in that by default, all 127.x.x.x addresses correspond to the local host.

Are docker0, lo and virbr0 are virtual network interfaces?

Yes, they don’t correspond to physical network interfaces.

Why are docker0 and virbr0 assigned private not loopback IP address?

Because they are not loopback interfaces. Such interfaces are generally used to communicate with containers or VMs, which are separate (from a networking perspective, which is what concerns us here) from the local host.

If private IP address can work like a loopback address, can lo be assigned a prviate instead of loopback IP address?

No, private IP addresses don’t work like a loopback address. (They can be made to work in any way you want, but that’s for networking experts and people who design systems such as Istio with Envoy, which uses an interesting loopback trick for multi-cluster setups.)

Loopback addresses are 127.*.*.*. Do they always form a network instead of being split into several smaller networks, as in the example?

See my first point.

192.168.*.* is a range of private IP addresses. Are they often split into several smaller networks, as in the example (wlx8 and virbr0)?

Yes; again, see my first point.

  • Thanks. (1) Loopback addresses are 127.*.*.*. Are they normally assigned to the same virtual network interface, or to different virtual network interface? For example, if a process sends a request to 127.0.0.2:2000, will a process listening at 127.0.0.1:2000 receive it? (2) I am still not sure: do 127.*.*.* addresses always form a network instead of being split into several smaller networks, as in the example? – Tim Mar 22 at 13:20
  • Loopback addresses don’t need to be assigned; try pinging different loopback addresses, you’ll see answers (from the local host) even though they’re not assigned. However they’re distinguished when binding, so a process listening on 127.0.0.1:2000 won’t receive traffic directed to 127.0.0.2:2000 (try it with nc). Perhaps my first point wasn’t clear: 127.x.x.x forms a single network. – Stephen Kitt Mar 22 at 13:27
  • ifconfig doesn't show any interface with 127.0.0.2. Is such a virtual network interface exist? If I ping it, should the virtual network respond? – Tim Mar 22 at 13:42
  • Re-read what I wrote, and try it. – Stephen Kitt Mar 22 at 13:43
  • Maybe I miss something. ping 127.0.0.2 can receives response. But ifconfig doesn't show any interface with 127.0.0.2. Is such a virtual network interface exist? How shall I understand it? Is ping supposed to test if a network interface for an IP address exists and is working? – Tim Mar 22 at 14:23
1

Are docker0, lo and virbr0 are virtual network interfaces?

Yes.

They are not all the same type. All it means is they are not provided by a hardware device. Virtual devices are listed in /sys/devices/virtual/. Look in the net/ subdirectory.

If private IP address can work like a loopback address,

I don't know what you mean

can lo be assigned a prviate instead of loopback IP address?

Yes. Worked fine for me, try it yourself. ip addr add <ADDR> dev lo.

Loopback addresses are 127.*.*.*. Do they always form a network instead of being split into several smaller networks, as in the example?

I don't really know. But I am suspicious of any software that relies on splitting 127.*.*.*. In IPv6, you only get one loopback address ::1. Because the authors did not find any good reasons for having a whole loopback network (let alone 2^24 such addresses). So, it is clear it was not used very much.

192.168.*.* is a range of private IP addresses. Are they often split into several smaller networks, as in the example (wlx8 and virbr0)?

Splitting 192.168.*.* into subnets is absolutely the most common way of using it. Your home router almost certainly uses 192.168.0.* or 192.168.1.* by default. This helps when you want to configure multiple subnets - e.g. a second network for guest Wi-Fi access, which is firewalled from your main network.

Why are docker0 and virbr0 assigned private not loopback IP address?

Why would they not be?

More specifically, the IPv4 standard could reasonably be interpreted as requiring all the loopback addresses to behave as loopbacks. This means that it is not legal to use them e.g. to communicate between a docker container and a docker host. Because they would no longer work as loopback addresses.

Maybe the standard requirement means something else. I.e. maybe it could be legal to use them to construct more complex virtual networks, if you never let them touch a physical network. The standard does not clarify this point. Where the loopback network is supported, it has generally been interpreted in the same way as Linux has. So people are used to that implementation, and would be confused to see something different.

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.