Conect network 1 in router 1 to network 2 in router 2

Hi all,
I have two routers RUT951 with the following configuration:
Router 1:
WAN IP: 192.168.250.10
WAN Subnet: 255.255.255.0
WAN Gateway: 192.168.250.11

LAN IP: 192.168.1.254
LAN Subnet: 255.255.255.0

Router 2:
WAN IP: 192.168.250.11
WAN Subnet: 255.255.255.0
WAN Gateway: 192.168.250.10

LAN IP: 192.168.1.254
LAN Subnet: 255.255.255.0

NOTE: Both routers conected from WAN Side.
My question is, is there a way to NAT the entire networks like, I would see LAN Network R1 from outside Router1 (LAN : 10.220.1.0/24) and for LAN Network R2 from outside Router2 (LAN : 10.220.2.0/24)?

Hi would be gratefull for an answer

Thank you all in advance,
Celso

Hello,

You can use iptable rules to enable communicationg between identical LAN networks. The rules would be similar to the ones outlined here. But you will need to replace your IP addresses accordingly. You can also put these rules into custom rules as mentioned in that post.

Something like:
R1:

iptables -t nat -I POSTROUTING -s 192.168.1.0/24 -d 10.220.1.0/24 -j NETMAP --to 10.220.2.0/24 
iptables -t nat -I PREROUTING -s 10.220.1.0/24 -j NETMAP --to 192.168.1.0/24

R2:

iptables -t nat -I POSTROUTING -s 192.168.1.0/24 -d 10.220.2.0/24 -j NETMAP --to 10.220.1.0/24 
iptables -t nat -I PREROUTING -s 10.220.2.0/24 -j NETMAP --to 192.168.1.0/24

Kind Regards,

Hi AndzejJ,
thanks for your fast repply an help.

I´ve tested the commands and it’s working fine.

Hope you continue with your great work! :slight_smile:

Greatings

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.