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
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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,loandvirbr0are virtual network interfaces?
Yes, they don’t correspond to physical network interfaces.
Why are
docker0andvirbr0assigned 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
lobe 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 (wlx8andvirbr0)?
Yes; again, see my first point.
Method 2
Are
docker0,loandvirbr0are 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
lobe 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 (wlx8andvirbr0)?
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
docker0andvirbr0assigned 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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0