How can I join two networks

What I want to do is to be able to access the network devices of network A from network B and vice versa. And I also want the devices to access the internet via the router on their respective network, for example PC A1 should access the internet via MODEM A and PC B1 via MODEM B. So, I want things to stay as they are right now, adding the ability for PC A1 to "see" PC B1 etc. so I can transfer files between them etc.

asked Aug 13, 2012 at 22:00 91 1 1 gold badge 1 1 silver badge 2 2 bronze badges

Are the routers physically close enough that you could (feasibly) run an ethernet cable between them? Or is that figuratively, like having two buildings and wanting the computers in one building to see the computers in the other building?

Commented Aug 13, 2012 at 22:08

@DarthAndroid adsl modem/routers that i've used have just been a switch and a very basic built in router that many wouldn't even call a router. like a router with 2 ports. Where you can't configure it to use different IP ranges on different ports. A "proper" Router wouldn't have an ADSL modem in it , last time I used them anyway.

Commented Aug 13, 2012 at 22:14

Depending on what you want, I've seen proper routers with cable or ADSL modems combined in. The easiest way to solve this is with a proper router, or at least one which allows you to specify custom routes. Would you happen to know the brand/model of the modem/routers in question? It would be helpful to see their actual capabilities. Do you have multiple connections ("Multi-WAN" or "Multi-homing") for redundancy purposes, or bandwidth purposes, or just because? If the router/modems are indeed super-basic, additional hardware might be involved.

Commented Aug 13, 2012 at 22:19

The modem/routers are aftermarket. It's a Linksys WAG160Nv2 and a high end Netgear. I can buy/replace anything needed.

Commented Aug 13, 2012 at 22:34

4 Answers 4

If the networks are close enough that you can phsyically connect them with an ethernet cable, then simply do that. You'll need to add routes to each router to handle the different subnets (i.e., 192.168.2.x vs 192.168.1.x ). For each router:

  1. Add a route for the other router out over the LAN interface.
  2. Add a route for the other subnet to go to the other router

For example on Router A, you should at a route for Router B's IP address (probably 192.168.2.1 ) over the LAN interface of Router A, and then you want to add a second route for 192.168.2.0/24 to Router B's IP address.

Repeat on router B, but with using Router A's IP and 192.168.1.0/24 as the subnet.

barlop's answer brings up some good points about DHCP and having two routers on the same physical network. While the above will get the packets to the right locations, look over his answer to make sure you have an idea how you want to deal with some of the complications that will arise from doing this.

answered Aug 13, 2012 at 22:14 Darth Android Darth Android 38.4k 5 5 gold badges 95 95 silver badges 112 112 bronze badges

I want each router to have DHCP enabled and handle the devices connected to it. I don't quite understand your solution; Will I just connect an ethernet cable between the routers (from a port on router A to a port on router B) and set routes? How exactly need these routes to be set? I've never done anything similar even though I'm kinda experienced with networking.

Commented Aug 13, 2012 at 22:42

@GeorgePsimenos The routes tell the routers how to direct the traffic. Due to the nature of most routers, you won't be able to simply use routes and have both do DHCP at the same time (I'd use static addressing, and then configure one router with DHCP for computers that are only temporarily on the network). The routes are set in the configuration of each router, if they support it.

Commented Aug 13, 2012 at 22:47

If B1 is looking for A2 , then it'll try to send a packet addressed to A2 to router B . B will see that all traffic for router A 's computers have to be sent to router A (Static route #2), and forward the packet to router A . The first static route specifies that router A exists on the LAN interface (where the ethernet cable is), so router B will use that to send the packet to router A . Router A simply forwards the packet to A2 .

Commented Aug 13, 2012 at 22:50 Much clearer now, but I'll have to try these in practice. Commented Aug 13, 2012 at 22:56

Event if these two routers are physically connected, you'll need to setup the ports that the inter-router cable connects to differently from the others and then setup static routes.

Many home routers support neither. For the ones that do, you probably have to use the "WAN" port to connect the two routers (as the LAN ports are behind a switch chip and cannot be configured individually), which means you'll have no access to an external network unless you do a more complicated configuration.

Also, Windows file sharing host discovery (which I assume is what you mean for computers to see each other) does not work very well over different sub nets. You'll have to do some setup so the broadcast messages go through, which you probably can't on a home router. However, you can still access the files by entering the IP addresses directly.

answered Aug 13, 2012 at 22:23 7,109 22 22 silver badges 36 36 bronze badges

You can connect Network A to a network switch, and Network B to a network switch.

Then connect each switch to a Central Router and configure the Router so one interface is for one IP range, the other for the other IP range.

And make sure DHCP isn't set on both routers. I suppose you either have to set the IPs manually to get the 2 different ranges. Or, get the central router to do the DHCP.

Those modem/routers most likely wouldn't cope with sending via DHCP one IP range on one port and another IP range on another port. My experience is they can't even cope with 2 different networks with 2 different IP ranges. But a central router (not modem-router) could and if not, then set IPs manually on each computer

You could perhaps look at it as one network 192.168.0.0 and configure both ADSL modem/routers that that's the network. Then you don't need a central router at all and can just connect them both together via ethernet cable. But then it's not two separate networks it'd be one network, but that's within the capabilities of your adsl modem-routers.