Is it possible to connect 2 networks with same IP range?
Solution 1:
It's very, very ugly. The simplest way is to construct a bridging network with two routers in it, with those two routers connected in the bridging network.
Each bridging router NATs 192.168.1.0/24
to a different /24 inside the bridging network. Assuming 192.168.10.0/24
, 192.168.11.0/24
, 192.168.3.0/24
are free and 192.168.1.251
is free in each network:
Router 1 works as follows:
Router 1 is assigned IP address
192.168.3.1/24
in the bridging network and192.168.1.251
in its own network.Router 1 has a connection to one of the
192.168.1.0/24
networks and NATs192.168.1.x
to and from192.168.10.x
Router 1 has a route for
192.168.11.0/24
with a next hop of192.168.3.2
in the bridging network.
Router 2 works as follows:
Router 2 is assigned IP address 192.168.3.2/24 in the bridging network and
192.168.1.251
in its own network.Router 2 has a connection to the other of the
192.168.1.0/24
networks and NATs192.168.1.x
to and from192.168.11.x
.Router 2 has a route for
192.168.10.0/24
with a next hop of192.168.3.1
in the bridging network.
In this way, machines on the 192.168.1.0/24
network connected to router 1 can access machines in the second network by using 192.168.11.0
addresses. Vice-versa for the other network, using 192.168.10.0
addresses.
The default router in each network must be configured to route packets for 192.168.10.0/24 and 192.168.11.0/24 to 192.168.1.251
. The routers can be cheap wireless routers running OpenWRT, Tomato, or DD-WRT. These routers can also be used for other purposes. For example, if they're already the default router for their 192.168.1.0/24
network, the configuration is slightly simpler.
While it should be possible to do this with a single router using both SNAT and DNAT, I've never gotten it to work. Others I know have reported similar issues. I believe it's because the ARP system can't handle two distinct ARP entries for the same IP on distinct interfaces.