How can I connect two networks with different IP addresses?
Question by DeMus /

I have a router with IP addresses 192.168.0.x. (1st network).
Connected to a LAN connection is a second router with addresses 192.168.1.x. (2nd network).
How do I make it possible for both networks to see each other, and to have internet from the 2nd as well as the 1st?

Browse other questions & answers in the category ; tagged , ; or ask your own question.

Comments for this Question are closed.

If you are looking for help, please ask a new question.

We will be happy to help you!

Answers (12)
  • Anonymous

     if you simply change the subnet mask from 255.255.255.0 to 255.255.248.0.
    So the network range is:
    192.168.0.0 to 192.168.7.255Or you use a subnet mask of 255.255.254.0In that case, the network range is in your case:192.168.6.0 to 192.168.7.255

    • Mike

      The idea is good but I’m tempted to say it won’t work since most home routers don’t allow a Class C network (192.168.0.0/24) being divided with a Class B CIDR/Subnetmask (CIDR /23, 255.255.254.0)

      Even if they do it’s still not advisable because older devices could face routing problems within the supernet. Also both Routers would need to support RIPv2

  • Mike

    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

    • DeMus

      Hi Mike, thank you for answering. In the first router (192.168.0.x) what should I fill in as rule so computers on the second segment (192.168.1.x) can connect to the first segment as well as to the internet which is connected to the first segment? I have a D-Link DIR-100 router should that be of any help.

    • DeMus

      Forget about the attached file, that was a mistake. Sorry

    • Mike

      If you were able to follow my instruction and everything is 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.

    • Mike

      add to single large network: of course DHCP should be disabled on Router 2  then

    • Demus

      Hello Mike, thanks again for your answer. It’s not that I “need” 2 network segments, I was just curious if this can be done, and if yes how.
      At the moment I did what you also wrote at the end of your story, connect the two routers with a LAN connection and switch of the DHCP in the 2nd router making it a switch. Tomorrow morning when I am alone in the house I will play around again, now I am only disturbing others when I reboot the routers.
      One question though: in my Dlink DIR-100 router I see a page Static Routing where I can fill in the items you mentioned: Dest IP, Subnet mask and Gateway. Only, at the beginning of each line it says Interface: WAN, which I can not change. Is this correct?
      Okay tomorrow I will give it a try. Let’s see what comes out. Thanks again.

    • Mike

      I looked through some interface screenshots of the DIR-100
      It appears it only allows entries in WAN direction – my personal advice? Just test it without the static route. 

      Maybe it works out of the box. With NAT on the second router it’s possible that it will just work. Also, thinking about how NAT works it might be that you actually need a static route on the DD-WRT router to tell it that there is “more than internet” (another part of the local network) behind the WAN interface.

      Unfortunately my second Router is on loan and I’m not eager to setup a linux router for this single testing purpose. Just give it a try and report back.

    • DeMus

      I give up. I tried everything you wrote and, when this didn’t work, even more.

      Router 1 (connected to the internet):
      WAN is DHCP from modem
      LAN is DHCP with addresses 192.168.0.100~149 (50 addresses), mask 255.255.255.0
      LAN address router is 192.168.0.1

      Router 2 (WAN) to router 1 (LAN)
      WAN address fixed to 192.169.0.10, mask 255.255.255.0, gateway 192.168.0.1
      LAN is DHCP with addresses 192.168.1.100~149 (50 addresses), mask 255.255.255.0
      LAN address router is 192.168.1.1

      In router 1 I tried you static rule, but this didn’t bring anything.
      I also tried some rules in the 2nd router to direct addresses outside segment 2 through the 2nd router (gateway) to the 1st segment, and if necessary through router 1 (gateway) to the internet. Didn’t work.

      Now I am back at square 1:
      1 router with addresses 192.168.0.100 ~149
      1 wireless switch (used to be router 2) for generating wireless contact to my laptop.
      It all works so I keep it like this. Experiment is over.

      Mike, thank you for your help and your patience to help me.

    • Bob Barnes74

      Very well put…..Tony Seven.

  • Bruce Epper

    A router is going to have at least 2 IP addresses, one on each side of it.  For what you are describing, you only need one router to connect the 2 network(s) or network segments together.  One interface needs to have an IP address to match the first subnet and the second interface needs to have an IP address to match the second subnet.  All machines on the second subnet need to point to the address on the second router interface as its default gateway assuming that the internet connection is on the first subnet.  The machines on the first subnet can have a default gateway of the internet router/modem or the internal router’s first interface depending on what is is normally accessing.  (It will still find the proper host no matter which interface you point it at from the first subnet.)