After configuring an IP of lo:0 in the linux system (the IP and eth0 are on the same network segment), other computers will not be able to ping the host.
Another computer ping this computer, from then on ping can not connect with this computer. You can ping each other normally before it is set up. In addition, it is also found that although it is not possible to ping this computer, this computer can normally ping the external computer.
Make a simple analysis by grabbing the bag.
In the absence of lo:0, when the computer A ping linux eth0, first send arp packet, eth0 reply arp packet, tell computer A (own eth0 mac address)
After computer A knows the mac address of linux eth0, it encapsulates and sends the icmp request packet. When linux eth0 receives the icmp request packet, it answers icmp reply.
At this point a successful ping process ends
In the case of lo:0, computer A still sends the arp packet first, but linux eth0 receives the arp packet and does not reply, that is to say, it does not tell
What is the mac address of computer A's own eth0? Computer A will not be able to send icmp request packets.
As for why linux did not answer the arp packet, I think it is the linux kernel that determines that there are two interfaces with the same network segment and does not know which interface to reply from.
The arp request packet was discarded.
In fact, it is an illusion that linux can ping the IP of an external computer. If you try ping, an IP that is not used by an external computer, but any IP in the same network segment as lo:0, you will find that you can ping.
To sum up
When setting IP on the loopback network card, do not have the same network segment mask as the IP of the real physical interface, and the mask is not in the same network segment, so that you can use the IP of the loopback network card and the IP address of the real interface.