1

Routing Scenario 1

Scenario 1

  • Let's say router A needs to send a packet to the destination 192.168.23.2 (router B in the B-C subnet)

  • It routes the packet through C (at a cost of 10, next hop being 192.168.13.1), even though it has a direct connection to B (cost 5) right? Since its routing table does not contain anything to link router B with the specified address, and logically the two IPs of B are two separate devices to these two networks?

  • Let's say router A needs to send a packet to the destination 192.168.23.2 (router B in the B-C subnet)

  • It routes the packet through C (at a cost of 10, next hop being 192.168.13.1), even though it has a direct connection to B (cost 5) right? Since its routing table does not contain anything to link router B with the specified address, and logically the two IPs of B are two separate devices to these two networks?

Scenario 2

  • The scenario is the same, A needs to send a packet to 192.168.23.2.
  • Let us now assume that the cost of A - C link is 100.
  • In my simulation, the shortest path to 192.168.23.2 is now 15. A -> B -> C -> B (Next hop from A is calculated as 192.168.12.1). Is this correct? Does this happen in the real world? Is there a solution to this small looping issue? Does B auto-detect that the destination is one of its own IP interfaces when it first receives the packet? If B has this capability, won't the path in the first scenario (A - C - B) technically not be the shortest one and hence would be wrong?
0

2 Answers 2

5

In simple terms, each router only knows what is directly connected, and whatever various routing protocols tell it.

"A" only knows about 192.168.23.0/24 because "B" and/or "C" have announced it. Unless "B" and "C" include /32 routes for their direct interfaces, "A" will not know that. In general, that level of detail is not necessary. Yes, if "A" sends traffic for 192.168.23.2 via "C", it's not the perfect path, but it will get there. When "B" answers, it will reply directly to "A" if the source was 192.168.12.1, because that's directly connected. If the source was 192.168.13.1, it could go either way, because "B" only knows about 192.168.13.0/24 via a dynamic routing protocol.

For every other address in 192.168.23.0/24, "B" and "C" are equally capable. (link speeds, physical distances, and traffic load aside.)

1

It routes the packet through C (at a cost of 10, next hop being 192.168.13.1), even though it has a direct connection to B (cost 5) right?

Lower cost is better, but both paths have the same path cost. Depending on port/IP preference, either B = 192.168.12.2 or C = 192.168.13.2 would be used. ECMP would use both alternately.

If the A-C link cost goes up to 100, A routes everything for 192.168.23.0/24 through B unless that link fails.

Path cost is calculated from all links up to the destination network. In your upper diagram, all directly connected networks have cost 5, and all remote ones cost 10.

[Scenario 2] In my simulation, the shortest path to 192.168.23.2 is now 15. A -> B -> C -> B

No, that's wrong - when a loop forms due to bad cost/routing information it'll repeat. Packets loop until their TTL expires.

There's no reason for that here though - the path from A to 192.168.23.0/24 is simply A->B->192.168.23.0/24 with cost 10.

2
  • hi, I'm specific to OSPF here, let's say the subnets do not exist between the links. Conforming to the router LSA construction algorithm for P2P links, router C would add a link to 192.168.23.2 (stub link of router B connected to C) and advertise to A. A would only know of 192.168.12.2 (stub link of router B connected to A). Without subnets, in case of all the links costing 5, router A would route it through C right (next hop for 192.168.23.2 would be 192.168.13.2) ? Commented Nov 11, 2024 at 21:26
  • To follow up, WITHOUT subnets, if the cost of the A-C links turns 100, the shortest path to C would now be through B, and hence A would calculate the next hop for 192.168.23.2 as 192.168.12.2, A -> B -> C? With subnets, B and C would both advertise paths to 192.168.23.0/24 and A would always route packets destined for 192.168.23.2 through 192.168.12.2 as the next hop I guess? Commented Nov 11, 2024 at 21:31

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.