2

From the title this question looks duplicate but it's not from the content!

My question is that if all networks with proper gateways are connected to each other in a single loop through routers without static routing, each router and computer is assigned the IP of the next router in clockwise direction as a default gateway now if I send a ping from PC1(192.168.111.55) to a computer in 192.168.3.x Network(see picture) then in my understanding ping should go through Router-A then Router-B and then Router-C and at last reach to the specified computer IP. Now again in my understanding(in this simplest configuration) the pinged computer will only know that 192.168.2.254 has pinged it but in fact that ping had came from PC1 so the reply(echo) should come back to Router-C then Router-B and then Router-A and at last to original computer PC1. So here the reply path must be same as the ping path but this is my understanding of the router functionality(Router translates the IP and works like a middleman so the destination computer does not know that the ping was, in fact, came from just one router away to the right). However many people say the path of reply can be different which make me crazy as i don't understand how the destination PC come to know of the PC1(unless told in the message packet).

Can somebody please help me clear the ideas that if I am correct that the reply path would be same as the ping path unless some special manual configuration. Or how is this possible that the reply path could be different?

Please feel free to edit the question if you can clarify it more. Thanks.

NOTE: I have taken the following image from HERE, where the author claims that the reply can follow the path of Router-D which I don't understand. (Yes if the computer from network-3 ping PC1 then , of course, the ping path should be Router-D else how can it come know of the IP of the PC1).

enter image description here

2

Just for clarity, when you say "each router and computer is assigned the IP of the next router in clockwise direction as a default gateway", that is definitely static routing.

Your computer 192.168.3.10's ping reply will definitely go to D. The basic routing algorithm when the IP stack gets a packet is

  1. Is it for me? If so I process it.
  2. Is it for something directly connected to any of my interfaces? If so send it direct
  3. Do I have a route for it? If so send it to that next hop.

A computer 192.168.3.10 sending a packet to 192.168.111.55 for any reason will send it to 3.10's default gate 192.168.3.1. "Any reason" includes "human told me to" (ping) and "I'm answering something" (ping reply).

The idea that the routers remember absolutely nothing about routes from one packet to the next is simultaneously a brilliant idea central to the internet protocol, and somewhat expensive to implement. It means the routes can change between one packet and the next and everything sorts itself out. If the router were to send things back where they came from, think about the situation where the routes change immediately after the packet arrived. Should the router follow its own, new, rule or the old, remembered, one? The simplicity of IP is exactly here: always follow your own rule for forwarding, never remember anything.

(Previous statement subject to caveats about sophisticated routing protocols, ethernet switching, and all kinds of special-case complexities. The base case is as simple as this.)

Hope that helps a bit.

Jonathan.

  • Thanks for the good reply. I'm again confused that from where 192.168.3.10 get the ip of the PC1. I think 192.168.3.10 should reply to Router-C as it is Router-C who pinged it! – Shujaat Ali Khan Oct 2 '17 at 12:40
  • I get confused because of the NAT! I have learnt that the router sends it's own IP and port to the outward network due to NAT. – Shujaat Ali Khan Oct 2 '17 at 12:45
  • Every packet contains of course the IP address of the sender as well as the IP address of the destination. My recomendation is read and re-read RFC 760 (specially diagram 3) and RFC 862 about interactions with ethernet. The incoming packet to the recipient will have the source IP address of the originator 111.55 and the source ethernet address of the last hop router. The ethernet address is basically completely ignored because of the principle of the layers of the IP stack. Leave NAT until you've got the basics clear. Maybe that helps a little more? J. – jonathanjo Oct 2 '17 at 12:53
  • Thanks for the recommendations, I would surely read and re-read RFC 760 and RFC 862. Before I accept your answer I want o ask one another question. If you convinced me their then surely I would hope that this answer would be correct. Link to the quesiton: networkengineering.stackexchange.com/q/44650/40372 – Shujaat Ali Khan Oct 2 '17 at 13:26
  • A correctly-implemented IP stack will never send packets for a non-local network address -- as defined by (myaddr & mask) != (hisaddr & mask) -- anywhere except to a next-hop router as defined by its routing table. Note that some IP stacks, including some versions of Windows, aren't correct and under some circumstances will send ARP requests for non-local systems and thus do very strange, non-IP things. Unix and Cisco systems never do it. (Also ignoring things you can do with bridging, tunnelling, or proxy ARP which make the far network address local.) The base case is simple. – jonathanjo Oct 2 '17 at 14:29
2

The ping echo request and its reply follow the current routes on the hosts and routers they cross. So, it's definitely possible that each follows a different route - depending on what exactly you're trying to achieve, using asymmetric routing may be seen as bad practice by some.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.