cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
244
Views
0
Helpful
7
Replies

Does Traffic go to Default Gateway before a host, both ways?

Robk13
Level 1
Level 1

Hello, I had a question that I can't find an answer to.. It is a dumb question I should know.

If PC1 wants to reach the internet, does all of it's outbound traffic have to go to it's routed interface (default gateway) first, or can it go from PC - Router A - Internet. 

For Inbound, same question, can it go from internet > Router A > PC1, or does the traffic have to go to the routed interface router first, like Internet > Router A > Default Gateway Router > Router A > PC1? 

 

Anything that may help me understand this better would be much appreciated. Thank you very much! 

 

Robk13_1-1727814079310.png

 

 

7 Replies 7

@Robk13 

 Yes, the traffic must pass through the gateway when living the PC. The turn traffic, not necessary.

But, your scenario is not good because you have a router(layer3 device) between your PC and your Gateway, this is not usuall. Unless your router A here is performing only layer2 connectivity, your gateway should be connected to the switch.

 

 But, answering your question, yes, exit traffic from PC will pass through the gaterway. Because the PC does not know how to send traffic to the internet, so, it send it to the gateway.

The return traffic is a different situation. When the traffic comes from the internet and hit the Router A towards PC1, if the Router A knows how to reach PC1, it will send the traffic to PC1 and not to gateway.

 

But again, this is a very  bad scenario.

FlavioMiranda_0-1727816019895.png

 

Thank you Flavio! 

I agree, not a great situation, but that is something that we have to set up now. Originally, the default gateway would be Router A, but the new DG router is being installed, and they are taking control of their subnets/vlans at the location. We will just using Router A for switching purposes. 

If the router A is doing only layer2 (switching) then there is nothing wrong with the scenario.  We can see the picture as  two switches in a row.

 On this case, the outbout traffic goes through the gateway and the inbound traffic also goes through the gateway as the router as layer2 device will not perform any routing on the return traffic.

The key point here is the Router A function. Router A as Layer2 device  all the traffic in /out must pass on gateway.

Joseph W. Doherty
Hall of Fame
Hall of Fame

NB: as shown, unless router A is doing bridging, the PC cannot reach its gateway router.

In general, this is an "it depends" answer.

Firstly, both routers must have an interface in the PC network.

Secondly, for to-the-Internet, the gateway router must allow redirects and believe the other router is a better, or the, path to the destination.

For return traffic, redirects and/or what router is the gateway, is usually a non-issue.  Best path to the destination is chosen.

Sorry Joseph, forgot to mention it is a Layer 3 switch, so router A doesn’t have an interface in the subnet the PC is in, just the Vlan. Yes the router A has a trunk link to the router interface router. So I guess I answered my own question, that they both do need to go to the routed interface router, since Router A is only doing switching. Thank you for the response! 


@Robk13 wrote:

Sorry Joseph, forgot to mention it is a Layer 3 switch, so router A doesn’t have an interface in the subnet the PC is in, just the Vlan. Yes the router A has a trunk link to the router interface router. So I guess I answered my own question, that they both do need to go to the routed interface router, since Router A is only doing switching. Thank you for the response! 


Laugh, other than I believe you're telling me the original OP topology diagram is inaccurate, which is fine because as I noted, what was posted won't work unless you bridge though Router A.   Could/would you provide what the actual physical and logical topology is?  With such, I could provide you options what you might do.

Regardless, though, my prior reply still stands, as it's generic, as is the basis of your question, whether a gateway router always needs to be used, if there's an alternative (better) path.  If my prior reply was unclear, a host can use another router, than its gateway, but it needs somehow to know to use the alternative.  (Another reason to use another gateway, could be due to dead gateway detection.)

Conceptionally, think of a host's default gateway like a router's default route.

I've already mentioned, a gateway sending (ICMP) redirects to a host.  Conceptionally, that's much like a router learning a better path via a dynamic routing protocol.

But, like a router's static routes, often a host's can have static routes defined on it too.

Also, although I've never seen it used, there's IRDP where hosts can identify multiple gateways dynamically.

If router A is l3 SW and don't have IP in subnet of PC then yes both way the traffic pass through GW

MHM

Review Cisco Networking for a $25 gift card