NAT for Overlapping Networks
Last updated
Last updated
When we have 2 networks with overlapping addresses, chances are it’s not going to work. Unless, you use NAT. The situation we have to deal is can be seen in the next diagram
We have 2 routers, Router 1 and Router 2, connected via the 12.12.12.0/24 subnet. Each router has a LAN interface on the 10.0.0.0/24 subnet (the overlapping networks). How can we communicate between Server 3 and Server 4 without changing the addresses on each router? Let’s take it from the top.
The starting configurations are:
Translate Server3’s IP address into 13.13.13.3 and Server4’s IP address int 24.24.24.4. Server 3 will use 24.24.24.4 to access Server 4, and Server 4 will use 13.13.13.3 to access Server 3. Each router will need to be aware of the inside global addresses used on the other router.
This was simple, but what if we have more than one IP addresses that must talk to each other? Adding static NAT entries for each host would not be much fun. The first option that comes to mind is to use dynamic NAT instead of the static NAT. Unfortunately, translations for inside source dynamic NAT are only created when the inside host initiates the traffic. We would have a situation, where most of the time the connection would not work, but some times it would. Can you guess when? The answer is when both hosts initiate a connection at about the same time (inside the timeout interval) and translation rules are created on both routers. Otherwise, the traffic would reach the router on the other end, but it would not know how to send it to the inside host.
Depending on the type of applications you can use Static NAT on one side and dynamic NAT on the other, but not both dynamic.
Sometimes you do not have access to all devices in the network. Maybe R2 belongs to another company. We have to do it all in our R1 router. This can be done if we change both the source and the destination address in the packet:
Again, depending on the side that initiates the connection you can use one static NAT and one dynamic NAT:
Server 3 will access Server 4 using 24.24.24.4 address
Server 4 will access Server 3 using 13.13.13.3 address