Network Kings

LIMITED TIME OFFER

$999 $499 only For All Access Pass Today! USE PROMO CODE : LIMITED

d :
h :
m

How does a packet flow?

In this post, we will learn how a packet flows during ping process when destination is on different network. In computer networking, ping command is used to check connectivity. Ping works on ICMP protocol. There are two ping messages-

  1. ICMP echo reply
  2. ICMP echo request
How does a packet flow?
Packet flow

Network topology: two different networks are connected.

To explain whole process, here I took this topology.

Start from very first when connections are just built and there is no information in ARP cache.

When we do ping from PC2 to PC1,(in cmd of PC2 type ping 192.168.20.3). A ping packet is generated that contains source IP, destination IP, ping data.

Destination IP

Source IP

Data

192.168.20.3

192.168.10.3

Ping message

Now it first checks destination IP field, to recognize destination is in my network or in some other network. (in this case PC 1 is in other network, you can see network id is 192.168.20.0)

So, now PC2 knows to go outside the network, first default gateway MAC address is required.

Note: Every interface has unique MAC address.

To know the MAC address of default router first it will send ARP request.  ARP request broadcasts in the LAN network and goes to all devices, but only default router will accept (in destination field default router IP is mention, it checks this is my address) and other devices discard the packet.

In the response of ARP request default router will send ARP reply (unicast message)in which it will send MAC address of its fa0/0 interface.

Now ARP process is completed and PC2 has MAC address of default router. Now a packet is generated at PC2 , packet consist

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

Destination IP and source IP field remains same, only destination MAC and source MAC will change as frame will forward.

Now, when this frame will reach at fa0/0 interface of router –

  1. Router first check the FCS field to detect the presence of error, if there is any error frame is discarded, only when there is no error router accept the frame.
  2.  Decapsulate (remove) the source and destination MAC. Then check the routing table that tells the next hop address and exit interface.
  3.  Encapsulate the packet with new source and destination MAC address. In source MAC field, it place the MAC address of fa0/1 interface of default router or in destination MAC field MAC address of next hop.

In above diagram as you can see PC 1 is directly connected to the default router interface fa0/1. So, after router frame is transmitted to PC1.

Note: Destination IP and source IP field remains same throughout the whole process. Only source and destination MAC field will change (as we all know data link layer is responsible for node to node delivery).