Thursday, 23 February 2012

How can I connect two networks with different IP addresses?


For internet access all you have to do is properly setup the second router:

connect the WAN port to the first router
set the WAN interface to either DHCP or manual/Static (whatever is available)

for manual or static the following needs to be done:
set the WAN IP Address and Subnetmask to one on the first network (e.g. 192.168.0.10)
set the WAN Gateway and DNS-Server to the first routers IP (e.g. 192.168.0.1)

The Ethernet side of the second Router should be setup as usual
IP Address of the Router e.g. 192.168.1.1
DHCP enabled, handing out e.g. 192.168.1.100-150 with Gateway 192.168.1.1 and DNS-Server 192.168.1.1

This is a very basic setup using the NAT feature of the Router and will allow all your clients to access the internet. 

If you need networking features between clients on both networks you will either have to enable advanced routing on the first router and add the appropriate routes to the network behind the second Router or use the easier and better option by combining both networks into one 192.168.0.x




---------------------------------------------------------------------------------------------------------------------
setup as expected the clients on the second network (192.168.1.0) should already have access to the internet.

How it should look like
Router 1 nothing changed at IP 192.168.0.1
all connected clients should have internet access

Router 2 with WAN connected to Router 1
WAN set to static/manual
IP = 192.168.0.10
GW = 192.168.0.1
DNS = 192.168.0.1 or from your provider, whatever works

LAN IP Address = 192.168.1.1
DHCP enabled
Range = 192.168.1.100-150
(GW = 192.168.1.1 if there is an option to set it)
DNS = 192.168.1.1 or from your provider, whatever worksIf you need connection between the LANs other then Internet access the static route on Router 1 should beDestination = 192.168.1.0Subnet Mask = 255.255.255.0Gateway = 192.168.0.10Or in words: You have to tell your first Router where it can find the second network.Should work, can work, but doesn't have to... there is a lot that can go "wrong", problems with Network Address Translation or the used Routing Protocol, problems with DHCP being forwarded to the second network ~ most of the time problems occur with firmware fixed "settings" that are not available to the user.

I once had a router that simply won't do the job with both networks being Class C (192.168.x.x). After changing the second network to Class A (10.x.x.x) it did work.

Unless you do need different Subnets I still recommend setting up a single large 192.168.0.x network ~ easier and safe to use. In that case Router 2 would just need a static IP e.g. 192.168.0.10 and then connect it to the first router via a LAN Port.

No comments:

Post a Comment