1

On my local host, there is a loopback address 127.0.0.1, and a wifi interface with private address 192.168.1.97 assigned by the local wifi network.

Do both the loop back and private IP addresses work at packet level in the same "loopback" way?

  • When a process sends a packet to lo 127.0.0.1, is it correct that loopback means that the packet doesn't leave the local host, but reach 127.0.0.1 on the same host?

  • When a process sends a packet to 192.168.1.97, will the packet have to leave the local host, reach the router of the local wifi network and the router then sends the packet back to the wifi interface at the same local host?

If in both cases, the packets don't leave the local host, what is the difference between private address and loopback address then?

Thanks.

2

Do both the loop back and private IP addresses work at packet level in the same "loopback" way?

All local addresses are usually treated like the loopback address, yes.

When a process sends a packet to lo 127.0.0.1, is it correct that loopback means that the packet doesn't leave the local host, but reach 127.0.0.1 on the same host?

That's the loopback function - the packet doesn't leave the host but it's treated like it has been received from the network. Usually, this is implemented in layer 3 = network layer.

When a process sends a packet to virbr0 192.168.1.97, will the packet have to leave the local host, reach the router of the local wifi network and the router then sends the packet back to the wifi interface at the same local host?

In your example, 192.168.1.97 is a local address. So, the packet doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97.

If in both cases, the packets don't leave the local host, what is the difference between private address and loopback address then?

The difference is subtle. If a listener is bound to 127.0.0.1 it can only be reached by packets addressed to 127.0.0.1 - practically only from the same host. A listener bound to 192.168.1.97 is only reached by packets addressed to 192.168.1.97 - from the network or from the same host. A listener bound to 0.0.0.0 is reached by any packet addressed to any local address.

  • Thanks. A packet sent to 192.168.1.97 "doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97." So same as sending a packet to 127.0.0.1. why nmap 192.168.1.97 returns less services than nmap 127.0.0.1? – Tim Mar 23 at 22:01
  • @Tim That is host-specific which is off-topic here. – Zac67 Mar 23 at 22:17
  • Thanks. In your last paragraph, a listener bound to 255.255.255.255 is reached by what packets? – Tim Mar 23 at 23:52
  • @Tim I'm not at all sure that's possible. If it is that should be limited broadcast only. – Zac67 Mar 24 at 8:44
  • Do you mean 255.255.255.255 can't be bound to a listening socket? Where can 255.255.255.255 be used instead? – Tim Mar 24 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.