0

ping 127.0.0.2 can receives response.

$ ping 127.0.0.2
PING 127.0.0.2 (127.0.0.2) 56(84) bytes of data.
64 bytes from 127.0.0.2: icmp_seq=1 ttl=64 time=0.068 ms
64 bytes from 127.0.0.2: icmp_seq=2 ttl=64 time=0.060 ms
64 bytes from 127.0.0.2: icmp_seq=3 ttl=64 time=0.062 ms
^C
--- 127.0.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2026ms
rtt min/avg/max/mdev = 0.060/0.063/0.068/0.007 ms

But ifconfig doesn't show any network interface with 127.0.0.2. Is there a virtual network interface exist for 127.0.0.2?

Are loopback addresses the only IP addresses which don't need to be assigned to a network interface or something else?

Why is 127.0.0.1 still assigned to a virtual network interface lo, according to ifconfig, if it doesn't need to be in order to work? I am not sure what Stephen reply Why is some virtual network interface assigned private IP address, while some is assigned loopback IP address? means:

lo gets an IP address assigned to it so that packets sent from it have a source IP address.

Can a packet be sent from a IP address which is not yet assigned to any (virtual) network interface? When I ping 127.0.0.2 I can get a response packet sent from it, even though it is not assigned to any (virtual) network interface.

Tim
  • 98,580
  • 191
  • 570
  • 977
  • You can also generally ping broadcast addresses without them being assigned to anything. (which will essentially just ping anything alive on that subnet) – jesse_b Mar 22 '19 at 15:01
  • 2
    This seems to be an incoherent and very roundabout way of asking _How come I can successfuly `ping` the address `127.0.0.2` on my Lubuntu machine when the traffic does not leave the machine and there's no network interface with that IP address?_ And note that this _is_ an operating system specific question in that regard. It does not happen on the BSDs. This question was asked at https://unix.stackexchange.com/q/169410/5132 and has no answer. It was closed as a duplicate but the purported duplicate did not actually ask or answer that question. – JdeBP Mar 22 '19 at 15:12
  • @Jesse_b In the broadcast case, isn't a IP address assigned to all the network interfaces on all the hosts in the network? – Tim Mar 22 '19 at 16:00
  • Yes but the broadcast address is a special address handled by whatever layer 3 device is serving that particular subnet. Although not technically assigned to any interface the router will know how to handle requests sent to it. – jesse_b Mar 22 '19 at 16:02
  • Multicast groups are similar. – Stephen Kitt Mar 22 '19 at 16:04
  • @StephenKitt Why is 127.0.0.1 still assigned to a virtual network interface lo, according to ifconfig, if it doesn't need to be in order to work? Could you explain what you meant by " lo gets an IP address assigned to it so that packets sent from it have a source IP addres"? – Tim Mar 24 '19 at 02:22

0 Answers0