Packet flow in the same Network - GeeksforGeeks (2024)

Last Updated : 13 Jun, 2022

Summarize

Comments

Improve

Prerequisite – How ARP works?
To transfer a packet from source to destination, both the MAC address and IP address of the destination should be known. If the destination MAC address is not present then ARP will resolve this issue first then the packet will be delivered to a destination host.

There are simple rules for a packet flow in a network:

  1. If the destination host is present in the same network as the source host then the packet will be delivered directly to the destination host using MAC address.
  2. Within a network, the packet will be delivered on the basis of MAC address.
  3. MAC address never crosses its broadcast domain.

Now, first, we have to take an idea about ARP.

Address Resolution Protocol –
Address Resolution Protocol is a layer 2(Data link layer) protocol that is used to find the MAC address of the known IP address.

There are some important terms associated with ARP:

ARP cache is a table maintained by ARP that contains an IP address with its associated MAC address and type. If MAC address is learned dynamically then the type will be dynamic and if MAC address is added manually then the type will be static.

Packet flow in the same Network - GeeksforGeeks (1)

ARP request is a broadcast message generated by the source to find the destination MAC address if the ARP is not resolved initially.

ARP reply is a unicast message from destination to source device containing the destination MAC address.

Explanation –

Packet flow in the same Network - GeeksforGeeks (2)

The steps included in the ARP process are as follows:-

When a source wants to send a packet to the destination device then,

1. The source ARP cache is checked if the ARP is resolved or not. If the ARP is not resolved, it puts the packet on hold and generates an ARP request.

Packet flow in the same Network - GeeksforGeeks (3)

2. If the ARP is already resolved then the packet will be delivered to the destination host.

3. The ARP request is broadcast all over the network to find out the device has a destination IP address.
Note – If the destination is present in the same network then ARP will find out destination MAC address but if it is present in a different network then ARP will find out default gateway MAC address.

Packet flow in the same Network - GeeksforGeeks (4)

4. When the device having the destination IP address receives the ARP request, it updates its own ARP cache.

5. The destination host machine generates an ARP reply containing its own MAC address.

6. Now, the device having the source IP address receives the ARP reply and updates its ARP cache.

Packet flow in the same Network - GeeksforGeeks (5)

7. Since, both source and destination IP address and MAC address are available now, therefore, the packet is delivered to the destination host.

Now, we have taken an idea about the ARP protocol. Let’s see about the packet flow.

Now we will understand how the packet is delivered to the destination when the destination is present in the same network(network of the source).

Packet flow in the same Network - GeeksforGeeks (6)

Here is the topology in which host A has IP address 192.168.1.1, host B has IP address 192.168.1.2, and the router has IP address 192.168.1.3 on interface fa0/0.

Now how to source device will know that the destination is present in the same or different network. Let us understand:-

AND operation is performed between the source IP address, source subnet mask and destination IP address, source subnet mask. If the resultant of both are the same then the destination is present in the same network otherwise in a different network.

Let us try to ping host B from host A.

Packet flow in the same Network - GeeksforGeeks (7)

As you can see 2 packets are generated, one of ICMP and the other of ARP(green). ARP frame is generated because host A has not yet communicated to host B i.e. the ARP has not been resolved i.e ARP will be resolved first so that host A has an entry for host B MAC address.

Packet flow in the same Network - GeeksforGeeks (8)

As already explained the ARP request will be broadcast first for the target IP address within the network because routers do not forward broadcast packets. The broadcast request is received by the switch as shown in the above figure.

Packet flow in the same Network - GeeksforGeeks (9)

The switch broadcasts the ARP request as the entry in the ethernet header is FFFF.FFFF.FFFF (broadcast MAC address).

Packet flow in the same Network - GeeksforGeeks (10)

The request is received by Host B as shown in the above figure. Host B generates an ARP reply immediately specifying its own MAC address.

Packet flow in the same Network - GeeksforGeeks (11)

Packet flow in the same Network - GeeksforGeeks (12)

Now the host B unicast the ARP reply to host A which is received by the switch which in turn forward it to host A as shown in the above 2 figures.

Note –
The switch is able to unicast the reply because the switch has put an entry for host A in its MAC table when hosting A broadcasts the ARP request.in the same way, a switch has also put an entry for the host B when the switch receives

the ARP reply.

Packet flow in the same Network - GeeksforGeeks (13)Packet flow in the same Network - GeeksforGeeks (14)

Now the ARP has been resolved and the ICMP will be unicast to the host B from host A(as shown above).

Packet flow in the same Network - GeeksforGeeks (15)Packet flow in the same Network - GeeksforGeeks (16)

Now the ICMP acknowledgement packet will be unicast from host B to host A i.e. host B is successfully pinged from host A as shown in the above figures.



saurabhsharma56

Packet flow in the same Network - GeeksforGeeks (18)

Improve

Next Article

Packet flow in different Network

Please Login to comment...

Packet flow in the same Network - GeeksforGeeks (2024)
Top Articles
How Big Is the SaaS Management Market? | Lumos
Lithium titanate battery technology a boon to the energy storage market
Craigslist San Francisco Bay
NYT Mini Crossword today: puzzle answers for Tuesday, September 17 | Digital Trends
St Als Elm Clinic
Boggle Brain Busters Bonus Answers
Produzione mondiale di vino
You can put a price tag on the value of a personal finance education: $100,000
414-290-5379
Globe Position Fault Litter Robot
Elle Daily Horoscope Virgo
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
Meritas Health Patient Portal
24 Best Things To Do in Great Yarmouth Norfolk
New Stores Coming To Canton Ohio 2022
Nutrislice Menus
Grab this ice cream maker while it's discounted in Walmart's sale | Digital Trends
Espn Horse Racing Results
Walgreens Tanque Verde And Catalina Hwy
Nurse Logic 2.0 Testing And Remediation Advanced Test
The Blind Showtimes Near Amc Merchants Crossing 16
Cvs El Salido
Ficoforum
CVS Health’s MinuteClinic Introduces New Virtual Care Offering
Pronóstico del tiempo de 10 días para San Josecito, Provincia de San José, Costa Rica - The Weather Channel | weather.com
San Jac Email Log In
Life Insurance Policies | New York Life
Kristen Hanby Sister Name
Bus Dublin : guide complet, tarifs et infos pratiques en 2024 !
Joe's Truck Accessories Summerville South Carolina
The Legacy 3: The Tree of Might – Walkthrough
Go Smiles Herndon Reviews
Craigslist Summersville West Virginia
Felix Mallard Lpsg
How Many Dogs Can You Have in Idaho | GetJerry.com
Devon Lannigan Obituary
Who Is Responsible for Writing Obituaries After Death? | Pottstown Funeral Home & Crematory
California Craigslist Cars For Sale By Owner
Woody Folsom Overflow Inventory
Atu Bookstore Ozark
Sechrest Davis Funeral Home High Point Nc
Craigslist Binghamton Cars And Trucks By Owner
Das schönste Comeback des Jahres: Warum die Vengaboys nie wieder gehen dürfen
Wood River, IL Homes for Sale & Real Estate
Ihop Deliver
The Plug Las Vegas Dispensary
Uno Grade Scale
How To Win The Race In Sneaky Sasquatch
라이키 유출
Nfhs Network On Direct Tv
Bomgas Cams
Latest Posts
Article information

Author: Dan Stracke

Last Updated:

Views: 6081

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.