2. Packet Flow
To deliver the packet to the destination host, the
source IP, destination IP, source MAC address
and destination MAC address should be known.
Some basic rules for the packet flow:
If the destination host is present in the same
network, then the packet is delivered directly to
the destination host.
If the destination host is present in a different
network then the packet is delivered to the
default gateway first which in turn delivers the
packet to the destination host.
If ARP is not resolved then ARP will be resolved
first.
3. Example:
we will try to ping from Host A to Host B and will check the packet
flow at each link
4.
5. 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.
6. The destination address is a broadcast address and hence once switch will
receive this packet it will forward it through all its port. Immediately after
the GARP we see the ARP comes to switch from Host A looking to IP-MAC
mapping for its default gateway address 10.1.1.2
7. 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.
This same procedure happens on the second leg where Router 2, Switch 2 and
Host B connect.
Now when we try to ping from 12.1.1.2 from 10.1.1.1 an AND Ping 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.
8.
9.
10. 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
11.
12. The same way packet travels back from Host B to Host A
where now the Dst IP is 10.1.1.1 and Src IP is 12.1.1.2.