Routing – How to Connect Two Routers with Different Subnets

routerroutingsubnet

I've seen a lot of questions about this, but haven't really understood/didn't match my issue.

I'm a newbie regarding networking.

I got two routers, both are connecting to the wan (giving them different external IP).

192.168.0.1 is a vilfo and 192.168.2.1 is a dlink860l

is there anyway to connect those, so a computer on 168.0.x can access the printer (and other service) on 168.2.x (and vice versa)

The vilfo is special router for vpn, and are powered by LuCI lede-17.01, so it's highly customisable (if you know what to do (I don't))

I do have another router that's not used at the moment, if a bridge or something like that is necessary.

*edit: I just tested to put a network cable between the routers (lan port to lan port), but nothing really happened, so I did some other stuff. about 30 mins later I get a mail from my vilfo saying that as new unit had been discovered.
Upon checking, I saw that it was the printer, on the other router that was detected..

I don't know why… but suddenly it just worked…*

Best Answer

As @mohammed said in his comment, you should have a look at static routing.

Let's suppose the router A (192.168.0.0) wants to communicate with the network behind the router B (192.168.2.0).

Using static routing, you'll simply add an entry in the routing table on the router A to tell "if I have a packet for network 192.168.2.0, I'll send it to the router 192.168.2.1 using my interface xxx".

Don't forget to also create a static route on the router B (if you don't, the communication will be unidirectional).

EDIT: according to @JacobEvans comment, I'll add that you'll also need a network between your 2 routers. You can use a site-to-site VPN (maybe your Vilfo router can do it) or a peering network, but I'll recommend a VPN since it's simpler to create.