When I connect to my friend's mobile Wi-Fi hotspot, we both have the same public IP address.

Now, when I go to duck.com, how does DuckDuckGo know where to deliver the packets? I mean, I and my friend have the same public IP address, so how does DuckDuckGo know who requested for the packet?

And do MAC addresses and private IP addresses play any role in this?

I'd really appreciate your answers. :)


When you connect a client to a network with private addressing as per RFC 1918, your WAN router needs to translate the source host's private source address to its own public address as source (source NAT). For the returning traffic, this translation needs to be reversed.

Accordingly, from the perspective of an external (public) host, all hosts behind the same NAT router share the same IP address.

Within the private network, each host requires a unique IP address.

MAC adresses are not important for this. The destination MAC address is used to forward a frame (that encapsulates an IP packet) within a subnet (or L2 segment, more precisely).

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