I'll try to answer all your questions one at the time.
First of all, you should take a look at ip(8)
manpages and take a time to read the manpage as explained here. You can learn a lot by reading the manuals someone had put time and effort to share precious information inside Unix-like Operating Systems.
In the first entry, does 127.0.0.0 represent the network of the
loopback addresses? Is 127.0.0.0 a broadcast IP address?
Yes. The 127.0.0.0
address represent the Network address(first address of a network). This is a conceptual definition of ipv4.
What is the difference between the two loopback broadcast entries: the
first one for 127.0.0.0.0 and the fourth for 127.255.255.255?
Conceptual: They are different. Network and Broadcast addresses. You will have to read some books or google it and find yourself those differences since that is out of scope here at U&L. Maybe this question at SE Network Engineering can help you:
Real use case: They are almost the same on Linux Server scenarios so, are created as brodcast
types of address. Quoting the wonderful linux-ip document:
...The network address and broadcast address are both entered as
broadcast
type addresses on the interface to which they have been
bound. Conceptually, there is significance to the distinction between
a network and broadcast address, but practically, they are treated
analogously, by other networking gear as well as the linux kernel...
That is an axiom, and you will have to accept it as it is. On practical use cases of routing there will be little to no difference on where those 2 addresses are used.
In the fifth entry, does 192.168.122.0 represent the network of the
loopback addresses? Is 192.168.122.0 a broadcast IP address?
No. That is the network address of your ens3
interface. Take a look at the dev
on that line. local
table is a place where local routes are stored. That doesn't mean only loopback related routes are there. Just the ones where you will deliver data locally.
Quoting ip
manpage again:
At startup time the kernel configures the default RPDB consisting of three rules:
1. Priority: 0, Selector: match anything, Action: lookup routing table local (ID 255).
The local table is a special routing table containing high priority control routes for
local and broadcast addresses.
What is the difference between the two broadcast entries: the fifth
one for 192.168.122.0 and the last for 192.168.122.255?
Same as question 2, but for network 192.168.122.0/24
dev ens3
and not loopback device: Conceptual differences with same use cases for real world routing.
Is 127.0.0.1 an address in 127.0.0.0/8? Why is the third entry for
127.0.0.1 singled out of the second entry for 127.0.0.0/8?
To ensure that all traffic related to 127.0.0.0/8
will be delivered locally, and the origin will always be 127.0.0.1
. Manpage again:
local - the destinations are assigned to this host. The packets are looped back and
delivered locally.
broadcast - the destinations are broadcast addresses. The packets are sent as link
broadcasts.
My point of view here is that this will force any traffic destinated to 127.0.0.0/8
network come from 127.0.0.1
. This may initially sound dumb but, you could have another application/service inside linux using the 127.0.0.2
address and since local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
route has 127.0.0.1
address as source (src
) this will avoid problems.