3
$ ip route show table local
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1 
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1 
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1 
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1 
broadcast 192.168.122.0 dev ens3 proto kernel scope link src 192.168.122.202 
local 192.168.122.202 dev ens3 proto kernel scope host src 192.168.122.202 
broadcast 192.168.122.255 dev ens3 proto kernel scope link src 192.168.122.202
  1. 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?

  2. 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?

  3. 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?

  4. 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?

  5. 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?

Thanks.

Tim
  • 101,790
  • Hey @Tim . Have you taken a time to at least read the answer i've put some effort to create? Or are you flooding U&L with questions that you will never read the answer? You should comment if you agree, disagree or if there is another additional doubt that was not covered on peoples answers if you want them to keep colaborating with you and reach the ideal answer you are expecting from the community ;) –  Apr 03 '19 at 11:26

1 Answers1

4

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.

  • I have upvoted your post. I haven't get to finish understanding your post, so not yet accepted it. I have many questions, and sometimes I am overwhelmed. Thank you for your patience and understanding – Tim Apr 03 '19 at 11:42
  • That's fine @Tim . Take your time cause this is a subject that will demand from you more than only Linux knowledge but also some Networking solid base as well. Maybe a book about networking should be a good start :) . The TCP/IP Guide is a good start, and have a good free content on it - http://www.tcpipguide.com/ –  Apr 05 '19 at 13:52