27

I want to join two different home networks together like so:

PC A1      PC A2                              PC B1      PC B2
  \         /                                   \         /
   Gateway A      <----- ethr. cable ----->      Gateway B
       |                                             |
  ADSL modem A                                  ADSL modem B

Both networks are of the basic residential type with identical configuration, with all PCs running Vista/7. The point is to temporarily join two apartments in a building for gaming and file sharing, and the holy grail would be:

  1. PCs on network A can access PCs on network B and vice-versa (file shares and gaming).
  2. Each network uses its own internet connection.
  3. Data between networks shouldn't take a trip through the internet (broadband upload speeds are severely capped)
  4. A network's internet access should continue working if the joining cable is disconnected with minimal configuration changes.

How closely can this be achieved?

0

8 Answers 8

16

Since you don't want to go through the Internet, you don't want a VPN.

You need:

  • networks A and B to be different, non-overlapping IP scopes;
  • a router between the two networks; and
  • gateways that let you add additional routs.

The router needs to have two separate ethernet connecters on it. The reason for this is because if you are using DHCP on either network, you need to be able to isolate the DHCP traffic to the appropriate network. If you just glue the two networks together with an ethernet wire, there's no way to guarantee that PCs on network A wouldn't get DHCP from network B, and then use network B's internet.

So your network diagram would look like this:

PC A1      PC A2                              PC B1      PC B2
  \         /                                   \         /
   Gateway A         ------ Router -----         Gateway B
   |                                             |
  ADSL modem A                                  ADSL modem B

Then, Gateway A would have a route on it telling it that Network "B" was reachable via the A address on the router; Gateway B would have a route on it telling it that network "A" was reachable via the B address on the router.

Now if you have a Linux-based firewall as either Gateway, then you can probably just put another ethernet card in it and have that Gateway act as the router as well, but that's left as an exercise for the reader.

If one of the PCs involved is stronger than consumer-grade Windows and has multiple ports, I believe that it could act as the router too. I don't think XP or Vista can act as a router, though.

Also, if you have a more "business" level firewall as either gateway, you may be able to mark some ports as a different "security zone" and use that box as the router.

Note that the Linksys or D/Link "DMZ" functionality is NOT what I am talking about here.

But my guess is we are talking $50 cheapie firewalls here, so you are probably looking at scrounging another box to do this job.

As a short term fix, you could replace one of the Gateways with a small switch, disconnect the DSL from that side of the network, and run a long cable to the other apartment. Then reboot the computers on the now-disconnected side. That would make those computers join the other network, which means that for the duration of the game they'd be using the Internet from the other apartment, but it would at least let you play. ie:

PC A1      PC A2                              PC B1      PC B2
  \         /                                   \         /
   Gateway A         ------ cable  -----           switch
   |                                       
  ADSL modem A                             
5
  • Thank you, that's very thorough. What if one was to deactivate DHCP and have all PCs use static addresses from their respective subnets? Would that remove the need for a middle router?
    – Alex J
    Sep 4, 2009 at 15:05
  • It would, yes, but DHCP is very useful. Sep 4, 2009 at 15:33
  • 3
    If you disable DHCP on one router, the other one will serve as a DHCP for the whole network. Sep 5, 2009 at 3:48
  • 1
    You don't need a middle gateway, just put DD-WRT or similar on one of the gateways. Any replacement firmware that allows you to configure vlans will do. If network A is 192.168.1.x and B is 192.168.2.x, you would just need to configure a port on a new vlan on gateway A and give it an IP of 192.168.2.2. connect that port to gateway B. Then on gateway B add a static route for 192.168.1.x through 192.168.2.2.
    – user23307
    Mar 21, 2010 at 17:04
  • @DavidMackintosh Can you please provide an example of a router that will fit the requirement? I understand that proposing specific brand or model may not be acceptable, but you could just provide the characteristics. Could a old pc running pfsense or similar software be used?
    – leopal
    May 6, 2019 at 10:39
6

This is pretty much how the internet works.

You would need to make sure your 2 Apartment building networks are using 2 different private networks. For example, one is using 192.168.0.x and the other 192.168.1.x.

The "Gateway" you are using needs to be a router - and I don't think the generic linksys will do. I haven't fooled around with the custom routing on there though; so it is possible you may be able to do it. If not then updated firmware such as Tomato or DD-WRT would work.

What needs to be set up is routing on either one, so that if the destination address matches the other network, it uses the interface that goes to the other network, rather than the ISP's interface. The other gateway would need to be set up the same way, vis-versa.

I think that is as simple as I can explain it, but let me know if you have any questions.

Using a VPN such as Hamachi would work, but data would go out over the ISP connection.

4
  • I don't know what his goal is with avoiding going out over the Internet, but if it's security then VPNs would be encrypted. If it's performance, he'd want to focus on getting routers set up to route traffic to the appropriate destination, much more of a PITA but it would be direct. Or look at load balancing the two connections and just combine the two networks into one. That might be even simpler yet :-) Sep 4, 2009 at 13:43
  • Furthermore, if both networks are bridged anyway, ditch the 2nd internet connection and have everyone chip in one the 1st one! Sep 4, 2009 at 13:45
  • Setting up routing seems to be the more robust solution, but I've never had any luck with it and I'm not sure if both gateways can do it in the first place. I'll look into this first, and failing that I'll go for VPNing two PCs together. Thanks!
    – Ilia Jerebtsov
    Sep 4, 2009 at 13:55
  • 1
    The goal with avoiding going out over the Internet would be to get 100Mbps network speed between the two LAN's. You'd not get anywhere close to that over household DSL. Oct 11, 2009 at 18:52
3

How about doing it in layer 2? No fancy router software required.

  • Have both networks be the same IP scope
  • Have each apartment's gateway use a different address in that scope
  • Have the DHCP servers allocate different host addresses within that scope
  • Use your dual-NIC machines as bridges (or see update below)

So you set Gateway A to 192.168.0.1, Gateway B to 192.168.0.128 (but each still using .255 netmasks). PC A1, A2, ... get

  • address 192.168.0.2, .3, ...
  • LAN netmask 192.168.0.255
  • default route 192.168.0.1
  • DNS servers for modem A

PC B1, B2, ... get

  • address 192.168.0.129, .130 etc.
  • LAN netmask 192.168.0.255
  • default route 192.1.0.128
  • DNS servers for modem B

Then PC A1 has all the settings to use modem A for internet access, but sees PC B1 on it's local network. It doesn't know that B1 has a different default gateway and DNS servers and it doesn't care.

The bit I'm not 100% sure about is using DHCP like this. I think that if you list each apartment's PCs' MAC addresses in each DHCP server then each PC will be happy to be served by the local gateway and won't worry that it is rejected by the other apartment's DHCP server. But if you can't, it's not hard to configure all the PCs' IP addresses manually.

Update: Actually there's no need for dual-NIC PCs and software bridges, just join one switch in each network together. Run your long cable from a spare LAN port on Gateway A to a spare LAN port on Gateway B. If your $50 gateways don't auto-sense crossover, use a crossover cable.

1
  • This might work, although it's a bit more hackish than doing the actual routing, etc. But it's always good to have another option.
    – Alex J
    Sep 8, 2009 at 16:50
2

You either: configure a VPN connection with two systems configured to create a tunnel between networks

Take a network cable and two machines with dual NICS and have it act as a router on both networks to route all traffic for each of the networks to the appropriate network (either internet or other network).

I'd look first at setting up a VPN solution.

1
  • That's certainly doable - we do have two dual-nic PCs. I want to try and see if I can manage setting up routing at the gateway level first. The less software involved the better, but I'm not sure it's possible with the hardware we have. Can you recommend any Windows-based VPN software that would be good for the job?
    – Ilia Jerebtsov
    Sep 4, 2009 at 14:00
1

This is totally doable. You could config a VPN using Smoothwall or you could simply share files using Hamachi.

4
  • I haven't heard of Smoothwall, I'll take a look. How would I connect the networks? A PC to another PC? I'm under the impression that Hamachi sets up a VPN through the internet. Can it be made to work locally like this too?
    – Ilia Jerebtsov
    Sep 4, 2009 at 13:37
  • Hamachi would send out data over the internet. It is definately the easiest way to get all of the PCs acting like they are on the same network, but I don't think it is your desired answer since the data would not bypass the local network (you would be limited by uplink speeds from your ISP). Sep 4, 2009 at 13:39
  • -1. This is no good because of the OP's point 3 - data between networks shouldn't take a trip through the internet.
    – tomfanning
    Sep 4, 2009 at 13:52
  • Hamachi and Smoothwall WILL send your data over the internet. I will edit my post with more info....
    – user5195
    Sep 4, 2009 at 14:05
0

If you want to bridge the networks without a cable (not sure of the distance between then) you can always go get a wireless router that has wireless bridging functionality. You can have one apartment broadcast a wireless signal, and the bridge grab it and act as a relay to the other apartment's network.

0

Or use a crossover cable, makes life much easier, but you lose a lan port in the router, since it doesn't use the internet port on either side.

0

VPN would be great, you even doesn't need the cable.

You had two different router rights? well try this:

PCA1 - 192.168.A.1
PCA2 - 192.168.A.2
GWA0 - 192.168.A.254 --> the lan ip on your router A

Change the B Network:

PCB1 - 192.168.A.3
PCB2 - 192.168.A.4
GWB0 - 192.168.A.253  --> the lan ip on your router B

The cable will connect GWA0 and GWB0

Then...

  • Disable DHCP on GWA0 and GWB0, or use static ip assigment to each pc on each physical network, so PCB2 will recieve 192.168.A.253 as his gateway, and so PCA2 will use 192.168.A.254
  • Filter out(Firewall) PCB2, PCB1 IP on GWA0, vice-versa on GWB0
  • The L2 broadcast between GWA and GWB will be locals

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .