How can I join two simple home networks together using an ethernet cable?

Solution 1:

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                             

Solution 2:

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.

Solution 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.