Page 1 of 1

Access to PC's in separate network with 2 routers

Posted: Mon May 21, 2018 10:03 am
by mihailJl
20180521_094156.jpg
This is my scenario!
I want to transfer files from PC1 to PC2!
Pinging TEST:
PC1 to: R1,R2,Cloud, 8.8.8.8 is success!
PC2 to: R1,R2,Cloud, 8.8.8.8 is success!
PC1 to: PC2 is unreachable!
What is the practice of putting these computers on the same network in this scenario?
Thanks!

Re: Access to PC's in separate network with 2 routers  [SOLVED]

Posted: Mon May 21, 2018 10:17 am
by sindy
What is the practice of putting these computers on the same network in this scenario?
You cannot put them to the same network, but you can add routes to R1 and R2 to the 172.16.x.x network served by the other one, and set an exception from src-nat or masquerade rule if such rule is configured:

R1:
/ip route add dst-address=172.16.1.0/24 gateway=192.168.137.3
/ip firewall nat add chain=srcnat action=accept src-address=172.16.0.0/24 dst-address=172.16.1.0/24 place-before=[find (chain=srcnat && (action=src-nat || action=masquerade))]

R2:
/ip route add dst-address=172.16.0.0/24 gateway=192.168.137.2
/ip firewall nat add chain=srcnat action=accept src-address=172.16.1.0/24 dst-address=172.16.0.0/24 place-before=[find (chain=srcnat && (action=src-nat || action=masquerade))]

Re: Access to PC's in separate network with 2 routers

Posted: Mon May 21, 2018 11:59 pm
by mihailJl
Thanks Sindy its work perfect!
And only i want to ask about the firewall NAT, why it is needed? I try without it and It works again.

Re: Access to PC's in separate network with 2 routers

Posted: Tue May 22, 2018 12:24 am
by sindy
Thanks Sindy its work perfect!
And only i want to ask about the firewall NAT, why it is needed? I try without it and It works again.
That's because I didn't know whether you have src-nat or masquerade configured on the uplink interfaces of the routers or not. If you do, the requests from the client in 172.16.x.x are src-nat'ed to 192.168.x.x so the server sees them as if coming from the router's address in 192.168.x.x rather than the actual address of the client in 172.16.x.x. It may cause issues to some protocols. The NAT rules I've suggested shadow the src-nat/masquerade ones specifically for packets between the two 172.16.x.x subnets to avoid this.

Re: Access to PC's in separate network with 2 routers

Posted: Tue May 22, 2018 1:06 am
by anav
Sweet someone should send you a nice piece of triple chocolate cake (fudge, mousse and dark chocolate)!!