Host 1—SW1—R1----R2—SW2–Host 2
In the above Network Topology. If i restarted all the devices and if i ping from Host 1 to Host 2 . How does the packet flow ?
I’m not sure I understand what kind of detail you’d like to be described, but I’ll take it step by step and you’ll let me know if there is anything else you’d like me to add.
- A packet is created by Host 1, the source IP address of Host 1 and the destination IP address of Host 2 are included in the header.
- The packet is encapsulated into a frame where the source MAC address of Host1 and the destination MAC address of R1 (which is the default gateway for the subnet) are placed in the header and the frame is sent.
- SW1 will receive the frame, will examine the destination MAC and will search for it in the MAC address table. The MAC of R1 will be found and the frame will be sent out of the appropriate port.
- R1 receives the frame, examines the destination MAC and sees that the frame is destined for itself. It removes the frame header and examines the destination IP address. It compares it with the routing table, sees that R2 is the next hop router and routes it out of the appropriate interface.
- As it is being routed out of the appropriate interface, a new frame header is added with the source MAC of R1 and a destination MAC of R2, which is the next hop.
- R2 recieves the frame, examines the destination MAC address which is its own, and removes the header. It checks the destination IP and compares it to entries in the routing table. It determines that the destination is one of its own directly connected networks and sends it out the appropriate interface.
- When it sends it out, it adds the frame header with the sources MAC address of R2 and the destination MAC address of Host 2.
- The frame reaches SW2 and it checks the destination MAC and compares it to the MAC address table. It determines the port out of which it should send the frame and does so.
- The frame reaches host 2 which examines the destination MAC address, sees that it is its own and removes the header. It examines the IP header and the IP destination address and sees that it is indeed its own. It removes the header and passes the data up to Layer 4 for reassembly into data and on to the application layer.
I hope this has been helpful!