Score:0

How can I connect two routers to the same switch

gb flag
7wp

First of all, I'm not talking about those all-in-one routers that do wifi/switching/routing. It drives me nuts when people call a Wifi box a "router". Anway, I would like to do the following as shown in my diagram:

Is it possible to connect Router A and Router B to the same switch, while having Router B be connected to a different subnet? Excuse my ignorance, but my motivation for setting it up this way is to make it so that when the computer labeled Computer on 172.5.1.0/24 tries to connect to a camera that is on a different subnet (10.5.1.0/24) traffic flows through the switch, then to Router B which routes the traffic to the appropriate subnet. I want to bypass Router A because I want to reserve that router to only handle traffic associated with the 172.5.1.0/24 subnet & internet. I don't want it involved when going to the 10.5.1.0/24 subnet, hence the second router connected to the switch.

Specific questions I need clarification on:

  • First of all, is this even possible?
  • With this setup will I have to configure some sort of manual routing information on each device/computer so that it knows to go to Router B when wanting to go to that subnet?
  • I am unclear on what the "Default Gateway" setting on each machine would be, or if it matters at all. Typically that would be set to Router A when only 1 router exists on the network. But what about when there are 2?.

EDIT: Notice the WAN port on Router B is empty, that's because I want to avoid putting any connected subnets behind a NAT.

enter image description here

Massimo avatar
ng flag
This is definitely possible. But it requires to at least have some general clues about how IP networking works.
7wp avatar
gb flag
7wp
right @Massimo that's why i'm struggling a bit, it's good to know it is possible. Perhaps I will give it a try and see where I end up. Can you think of any Caveats I should look out for ?
Jaromanda X avatar
ru flag
if a computer on 172.5.1.0/24 needs to access 10.5.1.0/24 (without traversing through router A) then it needs a route entry for 10.5.1.0/24 pointing to the 172.5.1.0/24 IP of Router B ... by the way, 172.5.1.0/24 is not a "private" subnet, for instance, 172.5.1.1 is `172-5-1-1.lightspeed.oshkwi.sbcglobal.net`
7wp avatar
gb flag
7wp
@JaromandaX Sorry about the subnets, it's just for illustration purposes i couldn't quickly come up with proper private subnet
7wp avatar
gb flag
7wp
@JaromandaX It's OK if it uses Router "A" for the purpose of lookup... as long as the rest of the actual traffic flows only through the Switch, then Router "B".. Is that the case? Or will traffic go to Router "A" and then back into the switch then into Router "B" because that would make me sad :(
Jaromanda X avatar
ru flag
not sure what you mean by "lookup".
7wp avatar
gb flag
7wp
@JaromandaX as in the computer wanting to connect to camera, goes to Router "A" and asks "Hey, whats the route to X"? (lookup) Then, thereafter computer goes directly to Router B via the answer it was given. From then on, theoretically you turn off Router A and the computer could still reach the cameras on Router B?
Jaromanda X avatar
ru flag
I'm not aware if such routing behaviour exists. However, you can have DHCP send routing info to clients, assuming you use DHCP. For devices that don't, you would configure the route to 10.5.1 on each client that requires access to that network ... though [IRDP](https://en.wikipedia.org/wiki/ICMP_Router_Discovery_Protocol) seems to be a thing, but how supported it is I have no idea
Score:3
bh flag

For clarity, let's assign Router A's inside interface 172.5.1.1 and give Router B 172.5.1.254.

Assuming SWITCH is strictly a layer 2 device, computers on 172.5.1.0/24 should have a default gateway to 172.5.1.1 [Router A] and a static route to find 10.5.1.0/24 via 172.5.1.254 [Router B].

Windows computers, for example, would run a command like the following:

route add -p 10.5.1.0 MASK 255.255.255.0 172.5.1.254 METRIC 10

Default gateway is shorthand for "what do I do with any traffic that isn't local and hasn't been explicitly routed?" The answer is almost always, "send it towards the Internet."

Many switches are layer 3 aware. The routing would be easier to manage there. If SWITCH can do vlans, Router B may not be adding much value.

7wp avatar
gb flag
7wp
Thanks I’m educated. Just wanted to let you know that SWITCH does support v-lans it’s set up that way now. But traffic still wants to go to ROUTER A first. For example if I reboot ROUTER A, I lose connection to the cameras on the subnet. Hence why I’m trying to introduce another router.
Maurkov avatar
bh flag
Is the computer on a trunked port or an access port?
7wp avatar
gb flag
7wp
Sorry @maurkov I don’t know what a trunked port is, so probably not.
Maurkov avatar
bh flag
@7wp a trunk port allows for crossing vlans where an access port does not. That's the only reason I can see for traffic hairpinning in the current 1 router solution. The switch is preventing computer and camera from interacting directly, but the router keeps sending the traffic back to the switch. Please try enabling trunking on the computer's switch port, then continuous ping the camera while you unplug and plug in the router.
7wp avatar
gb flag
7wp
Interesting @Maurkov I’ll give it a shot.
7wp avatar
gb flag
7wp
FYI @Maurkov that trunking idea didn't work. It just made my cameras inaccessible completely.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.