How does a packet flow?
Tuesday, October 5, 2021
In this post, we will learn how a packet flows during the ping process when the destination is on a different network. In computer networking, the ping command is used to check connectivity. Ping works on the ICMP protocol. There are two ping messages-ICMP echo reply, ICMP echo request.

Network topology: Two different networks are connected.
To explain the whole process, I took this topology.
Start from the very first when connections are just built, and there is no information in the ARP cache.
When we do a ping from PC2 to PC1,(in cmd of PC2 type ping 192.168.20.3). A ping packet is generated that contains the source IP, the destination IP, and ping data.
Destination IP | Source IP | Data |
192.168.20.3 | 192.168.10.3 | Ping message |
Now it first checks the destination IP field, to recognize destination is in my network or in some other network. (In this case, PC 1 is in another network; you can see the network ID is 192.168.20.0)
So, now PC2 knows to go outside the network, the first default gateway MAC address is required.
Note: Every interface has a unique MAC address.
To know the MAC address of the default router, it first sends an ARP request. ARP request broadcasts in the LAN network and goes to all devices, but only the default router will accept (in the destination field default router IP is mentioned, which checks if this is my address), and other devices discard the packet.
In response to an ARP request default router will send an ARP reply (unicast message)in which it will send the MAC address of its fa0/0 interface.
Now the ARP process is completed, and PC2 has the MAC address of the default router. Now, a packet is generated at PC2, and the packet consists
Destination MAC | Source MAC | Destination IP | Source IP | Data | FCS |
Fa0/0 router MAC | PC 2 MAC | 192.168.20.3 | 192.168.10.3 | Ping data | — |
The destination IP and source IP fields remain the same; only the destination MAC and source MAC will change as the frame is forwarded.
Now, when this frame reaches at fa0/0 interface of the router –
The router first checks the FCS field to detect the presence of an error; if there is any error frame is discarded, and only when there is no error router accepts the frame.
Decapsulate (remove) the source and destination MAC. Then check the routing table that tells the next hop address and exit interface.
Encapsulate the packet with a new source and destination MAC address. In the source MAC field, it places the MAC address of the fa0/1 interface of the default router, or in the destination MAC field MAC address of the next hop.
In the above diagram, as you can see, PC 1 is directly connected to the default router interface fa0/1. So, after the router frame is transmitted to PC1.
Note: Destination IP and source IP fields remain the same throughout the whole process. Only the source and destination MAC fields will change (as we all know data link layer is responsible for node-to-node delivery).