Should two routers use the same subnet mask?

By centrino207
Oct 6, 2013
Post New Reply
  1. I have two networks set up in my home .I have all wired computers hooked up to router A that is router / modem combo . All wireless and other wired computers hooked up to router B

    I have two subnet mask. Some one was saying if I use same subnet mask on both routers , I would have problems.Should I be using the same subnet mask? What is subnet mask ? When should I use two subnet mask ? I thought every network needs it's own subnet mask? Or data would not know to be sent to router A.

    Also router B does not need to know the gateway or DNS of the ISP , all it neesds to know is the IP address of router A.

    I read that DHCP should be disabled on router B . I do not know why that is the case.
  2. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    Yes, you need the same MASK - - but there are bigger issues than the mask itself.
    If you wire from A(lan slot) --->(lan slot)B (ie leave the B wan port empty, then you will use B as a switch, not a router - - very effective and 99% of the time, the solution you were after in the first place. If B has Wifi, that is still operational !!.

    We disable DHCP in the B router to make Q.a true. Router A's DHCP will control all devices attached to either A or B.

    Now to assist in allowing B to be configured while attached this way, it needs an IP address on the same subnet as A and A needs to never allow DHCP to handout B's IP address.
    SO:
    1. on A, set the DHCP range from 2-100 (that's more than reasonable)
    2. on B set its IP address static to 254 (if A is x.y.z.1 then B is x.y.z.254)
    [edit]
    If B has WiFI, then you can modify those settings with the browser
    http://x.y.z.254 and enter the user/pwd for router B
    [/edit]

    btw: if you wire A(lan)--->(wan)B, then B will enable NAT and devices on A will not be able to access devices on B.
    JC713 likes this.
  3. centrino207

    centrino207 Newcomer, in training Topic Starter Posts: 27

    What is the subnet mask? What could happen if the subnet mask is not the same?


    But how does router B know when to send it to router A?What does router B have to know to send it to A?

    Also what does router A have to know about router B ?
  4. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    it's magic stuff with tcp addressing and it's too much to explain. just make them equal and all will be well. Also, why do you worry so?
    two things control this; how you wire A->B and the routing table, and if the subnet mask bugs you, take a look at
    cmd prompt ROUTE PRINT output.

    nothing[/quote]
  5. centrino207

    centrino207 Newcomer, in training Topic Starter Posts: 27

    [/quote]

    This is what I'm confused about. I'm not fully understanding function of how a router talks to other routers , understanding the routing table and subnet mask.

    That simply this for home use and you can tell me what I'm not understanding.That say there are three computers IP address 192.168.0.2 ,192.168.0.3 , 192.168.0.4 and the IP address of the router or also know as gateway address of the router is 192.168.0.1.The router must know the gateway address of the ISP . So the router will forward it to the gateway address of the ISP.


    Now bit more complex . Say there is three computers down stars IP address 192.168.0.2 ,192.168.0.3 , 192.168.0.4 and the IP address of the router 192.168.0.1. Well up stars ( three more computers ) IP address of 192.168.1.2 ,192.168.1.3, 192.168.1.4 and the IP address of the second router 192.168.1.1. So the second router must know the IP address of the first router and the first router must know the IP address of the ISP gateway to send data out. Well incoming data the first router must know the IP address of the second router.

    This is what I thought how it works.Not sure how subnet mask ties in with this. I thought subnet mask was just telling router the data does not belong on its network but other network.So the first router would say no its not on my connecting computes but on the second router. And also you cannot have two computers using the same IP address but with subnet mask you can.That how I thought how it worked.
  6. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    Actually, the router[hardware] only knows the devices attached to it and the gateway address. If the target address is not attached to this router (ie has an address matching the subnet), then it logically says "heck if I know - - punt the data out the gateway and see what happens".

    No, routerA(192.168.0.1) knows nothing of routerB(192.168.1.1)

    The solution is in the routing table.

    take this:

    notice that [W](the wan side of routerB). Every router has two addresses,
    1) the uplink for output leaving the subnet
    2) the lan ports belonging to this router (aka this subnet)
    Looking from inside routerA, routerB [W] has an address belonging to routerA's subnet (eg 192.168.0.254).

    With only the information stated above, a PC trying to access a routerB device will fail, as,
    all 192.168.1.x addresses are not part of routerA's devices and "heck if I know - - punt the data out the gateway and see what happens" - - the data goes UPSTREAM to the ISP and fails.

    When properly configured, the ROUTING table solves this dilemma with a line
    The BLUE line is known as the default route and says to reach the gateway, send packets on the NIC address 192.168.0.5

    The RED line says, to reach any 192.168.1.* address, send the packets to the address 192.168.0.254 (the [w] side of routerB). Once inside routerB, it's his job to find the device

    [sorry for the reedit - - fumble fingered moused the wrong button]
  7. centrino207

    centrino207 Newcomer, in training Topic Starter Posts: 27

    Okay I think I get it now.If the target address is not attached to the router and , or using different subnet it pass it to the gateway.So from what I understand you are saying router A would not communicated with router B , because I'm using other subnet. Well up stars ( three more computers ) IP address of 192.168.1.2 ,192.168.1.3, 192.168.1.4 and the IP address of the second router 192.168.1.1 is on other subnet and thus the router would not communicated with router B. So router A would say 192.168.1.2 ,192.168.1.3, 192.168.1.4 and the IP address of the second router 192.168.1.1 is not part of my subnet and pass it to the gateway , NOT IP address of the second router 192.168.1.1.

    So for router A to see every thing and forward the data to all devices must be on the same subnet and DHCP turn off on the router B so there no duplication of IP addresses or other subet.

    Now where does LAN and WAN come in here? I sorta wanted router B controlling the computers on its network , because it is all set up.Than using router B has switch and router Acontrolling the computers on both , making it only one network.
  8. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    If you're wired ISP==RouterA----RouterB then sorry, RouterA *MUST* be in control.

    Let me be clear on subnets--
    Given an IP address of the form aa.bb.cc.dd, then the MASK will create a subnet like:
    1. mask 255.255.255.0 => subnet aa.bb.cc like 192.168.0.*
    2. mask 255.255.0.0 ===> subnet aa.bb like 172.16.*.*
    3. mask 255.0.0.0 =====> subnet ss like 10.*.*.*
    1) is known as a Class C address, (2) is a Class B, and (3) is a Class A.

    The RouterA subnet 192.168.0.* is different than RouterB's subnet 192.168.1.* because of the subnet mask 255.255.255.0

    Now don't assume you can change the mask to 255.255.0.0 and make things work for 192.168.*.* - - the routers we use at home will not allow that setting just to keep us from ourselves.
  9. centrino207

    centrino207 Newcomer, in training Topic Starter Posts: 27

    That is not the subnet mask I'm using . Router B 192.168.1.1 and subnet mask 255.255.255.128. Well Router A has IP adress 192.168.0.1 and subnet mask255.255.255.0 showing for Private LAN. Well WAN Address
    99.227.159.27 and Subnet Mask 255.255.254.0 the Gateway Address
    99.227.158.1

    The Private LAN DHCP Setting DHCP Start IP 192.168.0.10 and
    DHCP End IP 192.168.0.199. On router A

    The router B Ethernet cable is hooked from WAN port aka internet port to the LAN port 1 of router A.

    Router A just router well router B is router and modem combo built into one got from my ISP.
  10. jobeard

    jobeard TS Ambassador Posts: 13,336   +293

    that's more restrictive and reduces the number of devices
    very typical
    yes, this mask allows
    99.227.159.* and 99.227.158.* to be considered as being on the same subnet


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.