How to connect 2 different networks using a Router
Solution 1:
I am writing this just to jot down my ideas, since no one seems to be interested in it at all.
It can be done with a single DD-WRT router (or OpenWRT, or Tomato, or...).
The physical links: one ethernet cable from each of the two other routers, LAN port to LAN port; also, one ethernet cable from DD-WRT router's LAN port to switch for the 192.168.0.1 network;
change of subnet network: life is much easier if the dhcp server on the DD-WRT uses the subnet
172.16.0.0/14
, and if dhcp addresses are drawn from172.17.0.0/24
. The network mask must be changed also on the other routers, and specific routes toward the other two subnets thru the DD-WRT router must be specified with the other two routers.create three VLANs, one for each ethernet cable, as explained on the DD-WRT wiki; however, be careful that the VLAN associated to the (former) subnet 192.168.0.0/24 can be associated with the wifi, as explained again on the DD-WRT Wiki; this results in a new bridge, let's call it br1;
disable DHCP, and enable
dnsmasq
as both the DNS and the DHCP server, as explained on a this page of the DD-WRT Wiki;force the dnmasq dhcp server to listen only on interface
br1
, and setup iptables rules allowing packets to flow across the two VLANs and the bridge, as explained on this DD-WRT wiki page.
This should be all. At some point in the future (= when I find some free time) I will actually implement it and fully debug it.
Solution 2:
You probably mean you want to connect three different networks, since the Internet will "count" as a network.
For the router to support this, it needs three interfaces, essentially, a WAN, LAN1, and a LAN2, and a firmware/OS that supports this.
I don't know of any built-in firmware on consumer grade routers providing this capability. Linux has no problem routing between 3 or more interfaces. A router flashed to DD-WRT or Open-WRT provides Linux.
You still need a LAN1 and a LAN2. So you have several options, on a flashed router:
- The router's wireless capability can be a LAN1 or LAN2. I think most of not all DD-WRT flashed routers allow you to bridge wireless or not bridge wireless. You want it not bridged.
- If the router supports putting each of the LAN ports in a VLAN, you can split the LAN ports up into two separately routed interfaces. I've never really messed with the VLAN options in the few routers I've flashed to DD-WRT so I don't really know what can be done here or specifically on a Netgear.
- If the router has a USB interface (for network attached storage), you "might" be able to connect a USB-to-Ethernet adapter and have it work. I've never tried it.
If your Netgear router is not versatile enough, you may have better luck getting an old PC, throwing 3 network cards in it, and setting up basic routing/firewalling with Linux.
Solution 3:
Most consumer wireless routers only have a WAN and a LAN interface.
The 4 ports act as a switch, they just forward traffic to an IP, they don't have an IP of their own.
That beeing said, you will probably need different hardware unless you can set up multiple LAN interfaces, or a secondary IP on your LAN interface (this last option will not seperate traffic though).
As ultrasawblade pointed out the hardware you need is a router whith two actual LAN interfaces. Or you can check if your Netgear is supported by DD-WRT.
What you ideally should implement is a router-on-a-stick configuration, but then you require to have VLAN's in your network.