Networking – Do two computers connected on the same Wi-Fi have the same IP address


Do two computers connected on the same Wi-Fi have the same IP address (for example, my dad's computer and my computer, at home)?

If so, how does the outside world distinguishes one computer with the other? (for example, when a server wants to send us back some data).

Best Answer

You're both seen as having the same IP address externally.

Your router will relay requests to the originating computer. The procedure used for this is network address translation (NAT).

One of the ways computers on the same network get distinguished in communication with the same public server is by assigning them by the router different port numbers in the communication. Their public IP address is the same, but the port number part is not. From the article:

To avoid ambiguity in how to translate returned packets, further modifications to the packets are required. The vast bulk of Internet traffic is TCP and UDP packets, and for these protocols the port numbers are changed so that the combination of IP and port information on the returned packet can be unambiguously mapped to the corresponding private address and port information.

However, if you were to try to communicate to your father's computer, you will be using your internal addresses.

These use a custom range intended only for internal use: private address range.

Computerphile has a YouTube video on this exact subject: Network Address Translation (video).