Rashmi Bhardwaj | Blog,Protocol,Routing & Switching

In this document we will walk through how the packet flows when the communication happens from a host machine on network with another host machine on different network.

Let us take the simple topology as below to understand the packet flow:understanding-basic-packet-flow



In the above topology we will try to ping from Host A to Host B and will check the packet flow at each link.


At the very beginning of this communication when we first power on the devices there a Gratuitous ARP frame sent out from Host A which will have below packet structure.

In this GARP we see the host A sends its own IP address in Sender and Target IP Address field to check for any duplicity of this IP on the network. The destination address is a broadcast address and hence once switch will receive this packet it will forward it through all its ports.Immediately after the GARP we see the ARP comes to switch from Host A looking to IP-MAC mapping for its default gateway address


Packet looks as below:







We see an ARP request comes from Host A for its default gateway address which is again a broadcast. Switch 1 forwards the broadcast frame from its all ports and once this frame is received on Router 1 it replies with its MAC address of E0/0 interface in Target MAC field. This is then relayed back to the Host A to resolve its ARP table for


Switch also updates its CAM table with MAC addresses as below:

When GARP frame is received switch 1 gets to know that Host A MAC address connects to interface E0/0.When ARP replies comes from router switch 1 also learns Router’s E0/0 interface address on its E0/1 port.

Switch1#sh mac address-tableMac Address Table


Vlan   Mac Address       Type       Ports

—-   ———–       ——–   —–

   1   aabb.cc00.0300   DYNAMIC     Et0/1 < MAC address of routers Int e0/0>

   1   aabb.cc00.0600   DYNAMIC     Et0/0   <MAC address of Host A>

Total Mac Addresses for this criterion: 2

This same procedure happens on the second leg where Router 2, Switch 2 and Host B connect.

Now when we try to ping from from an ANDing operation is performed by Host A based on which Host A comes to know the network lies in different network and hence it forwards the packet to its Default Gateway.When this packet crosses the switch 1 it will simply forward the packet without changing anything.


Capture from Host A to Switch 1 link:



Capture from Switch 1 to Router 1 link:



Host A MAC address is: aabb.cc00.0600  

Router 1 E0/0 interface MAC address:

Router 1#sh int eth0/0Ethernet0/0 is up, line protocol is up

Hardware is AmdP2, address is aabb.cc00.0300 (bia aabb.cc00.0300)

Internet address is

We nothing is changed on the packet as it crosses the switch.


Now let us capture the link between Router 1 to Router 2:




MAC address of Router 1 E0/1 and Router 2 E0/0 interface:

Router 1#sh int eth0/1Ethernet0/1 is up, line protocol is up

Hardware is AmdP2, address is aabb.cc00.0310 (bia aabb.cc00.0310)

Internet address is

Router 2#sh int eth0/0Ethernet0/0 is up, line protocol is up

Hardware is AmdP2, address is aabb.cc00.0500 (bia aabb.cc00.0500)

Internet address is

Here we see when packet traverses from Router 1 to Router 2 only the source and destination MAC addresses are changed but src-dst IP remain the same.


Till now our packet has reached from Host A to Router 2.

Router 2 can also send an ARP request for IP address if not already resolved.




ARP reply from Host B:



Once this ARP is resolved for Host B the packet gets forwarded as below:



Source IP and Dst IP remain the same.Src MAC is the MAC of E0/1 interface of Router 2.Dst MAC is the MAC of Host B.

Router 2#sh int e0/1Ethernet0/1 is up, line protocol is up

Hardware is AmdP2, address is aabb.cc00.0510 (bia aabb.cc00.0510)

Internet address is

Switch 2 forwards this frame as it is to Host B and is seen in the capture below:



The same way packet travels back from Host B to Host A where now the Dst IP is and Src IP is


Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart