Suppose we have 2 networks with 3 PCs in each. As I understand, they can easily have the same IP addresses, but routers have different public IP addresses(e.g. here and So how PC in the left network with IP address can communicate with PC in the right network with the same IP address without knowing his private IP address(even if PC in the left network knows IP address of PC in the right network, it does not make sense to send a packet to the same IP address, so PC in the left network uses and only addressing right network's router public IP address For example packet from the left network will have DEST IP but how to understand which PC of those 3 to send a packet

PC------------|                              |------------PC
( |                              |            (
|             |                              |
|             |                              |
PC------------Router----------------------Router ---------PC 
( (               ( (
|             |                              |
|             |                              |
PC------------|                              |-----------PC
(                                        (

2 Answers 2


You are referring to the NAPT variant of NAT. In such a case, you must have NAPT port forwarding configured on the NAPT router. You cannot directly connect to a private address across the public Internet; you can only connect to a public address that way. The NAPT router with the public address must be configured to forward the specific protocol (TCP, UDP) and the port on that protocol to an inside device.

Remember that NAPT is a kludge to extend the life of IPv4 until IPv6 is ubiquitous, and IP was originally designed for end-to-end connectivity where every device has a unique address. IPv6 has enough addressing to restore the IP end-to-end paradigm.

This answer has more information about the IPv4 address shortage, the mitigations, and the solution.


Routers route between networks. For them to work correctly you require unambiguous addressing. Duplicate addresses like in your diagram prevent proper operation unless you build workarounds.

The most reasonable thing to do is to renumber one of the networks, so that host and network addresses become unique.

Another option is to hide the remote addresses behind a translation scheme - e.g. you use to refer to the right-hand network from the left side, and for the opposite direction. The routers in the path then translate the addresses to the ones actually used.

The left would address the right one by using as destination. One of the intermediate routers would translate the destination to and the source to (for the return path). The reply packets would require translation in the reverse way. This option is generally very cumbersome to work with and should be avoided (like NAT in general).

The other problem in your scenario is that the private networks are connected across a public path. If your route packets out to the public with private source addresses they'd either be filtered right away by your ISP or their replies could never find their way back.

To use transparent, private addressing across a public address space you require tunneling: your privately addressed inner packets are encapsulated by publicly addressed outer packets that can be forwarded between the routers. The remote router removes the outer encapsulation, and the private packet can then continue to the destination host. Usually this kind of tunneling is combined with encryption, so you'd have a VPN link.

Another option (that Ron has hinted at) is to hide the private addressing behind a public-to-private translation scheme both ways (aka port forwarding or destination NAT), e.g. the left would use to access on the right side, for and so on. For more than a small number of exposed services that quickly becomes extremely cumbersome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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