Address Resolution Protocol (ARP)
Index
● Introduction
● Addressing and subnetting
● Routing
● ARP
● IP header
● ICMP protocol
● DHCP protocol
● NAT mechanism
● RIP dynamic routing
● Security notions
Lucas Bazilio - Udemy
Address Resolution Protocol
Lucas Bazilio - Udemy
Address Resolution Protocol
➢ Address Resolution Protocol (MAC)
➢ RFC 826
Network
DATA Source port
It is known which application we
application Destination port
want to dialogue
Transport Source @IP
Destination @IP It is known which host we want to
dialogue
Network
Source @MAC
Destination @MAC
Network
interface FRAME It is not known what is the number
of the destination card of the plot
Lucas Bazilio - Udemy
Address Resolution Protocol
ARP objective
➢ From an @IP it discovers the @MAC of other devices (hosts or routers) that
belong to the same network
Lucas Bazilio - Udemy
Address Resolution Protocol
ARP objective
➢ From an @IP it discovers the @MAC of other devices (hosts or routers) that
belong to the same network
➢ Hosts and routers store these resolutions in an ARP table
Lucas Bazilio - Udemy
Address Resolution Protocol
ARP objective
➢ From an @IP it discovers the @MAC of other devices (hosts or routers) that
belong to the same network
➢ Hosts and routers store these resolutions in an ARP table
○ Resolutions consist of associating an @IP with a @MAC
Lucas Bazilio - Udemy
Address Resolution Protocol
ARP objective
➢ From an @IP it discovers the @MAC of other devices (hosts or routers) that
belong to the same network
➢ Hosts and routers store these resolutions in an ARP table
○ Resolutions consist of associating an @IP with a @MAC
○ Each resolution has a lifetime (duration); if a frame with the same
@IP-@MAC association is not received for a while, the resolution is
cleared
Lucas Bazilio - Udemy
Address Resolution Protocol
ARP objective
➢ From an @IP it discovers the @MAC of other devices (hosts or routers) that
belong to the same network
➢ Hosts and routers store these resolutions in an ARP table
○ Resolutions consist of associating an @IP with a @MAC
○ Each resolution has a lifetime (duration); if a frame with the same
@IP-@MAC association is not received for a while, the resolution is
cleared
○ @IPs are assigned by an administrator while @MACs are fixed,
therefore @IPs can change and the resolution in the ARP table must
change
Lucas Bazilio - Udemy
Address Resolution Protocol
ARP objective
➢ From an @IP it discovers the @MAC of other devices (hosts or routers) that
belong to the same network
➢ Hosts and routers store these resolutions in an ARP table
○ Resolutions consist of associating an @IP with a @MAC
○ Each resolution has a lifetime (duration); if a frame with the same
@IP-@MAC association is not received for a while, the resolution is
cleared
○ @IPs are assigned by an administrator while @MACs are fixed,
therefore @IPs can change and the resolution in the ARP table must
change
ARP Table Initially the table is empty
Duration Usually 5 or 20 minutes
Lucas Bazilio - Udemy
Address Resolution Protocol
Example
● Direct delivery (to a destination in the same network as the origin)
Lucas Bazilio - Udemy
Address Resolution Protocol
Problem
● We have to encapsulate the datagram in a frame and know the destination
@MAC
FRAME
Lucas Bazilio - Udemy
Address Resolution Protocol
● PC1 consults its ARP table and does not find the resolution
● PC1 sends a broadcast ARP request on its network asking for the @MAC of
@IP 10.0.0.30
ARP Table of PC1
duration
Asks who has the 10.0.0.30
FRAME in
broadcast
Lucas Bazilio - Udemy
Address Resolution Protocol
● The ARP request is broadcast, it reaches all the destinations of 10.0.0.0/24
● Everyone reads the ARP and sees if the question is for them.
ARP Table of PC1
duration
Lucas Bazilio - Udemy
Address Resolution Protocol
● The questioned is PC3
● Only PC3 updates its ARP table and replies with an ARP reply only to PC1
ARP Table of PC1
ARP Table of PC3
duration
duration
The destination @MAC of
the frame now is known
Lucas Bazilio - Udemy
Address Resolution Protocol
● PC1 receives the ARP reply, updates its ARP table
● PC1 can now transmit datagrams to PC3
ARP Table of PC1
ARP Table of PC3
duration
duration
FRAME
Lucas Bazilio - Udemy
Address Resolution Protocol
● Example
○ Indirect delivery (the destination is in another network compared to the origin)
Lucas Bazilio - Udemy
Address Resolution Protocol
● Problem
○ Encapsulate the datagram in a frame and know the @MAC of the destination of the frame
To whom should the frame be sent?
FRAME
Is it necessary to discover the @MAC of PC3?
Lucas Bazilio - Udemy
Address Resolution Protocol
● Problem
○ Encapsulate the datagram in a frame and know the @MAC of the destination of the frame
To whom should the frame be sent?
FRAME
Is it necessary to discover the @MAC of PC3?
Frames do not cross networks, they only serve to
communicate devices on the same network
Lucas Bazilio - Udemy
Address Resolution Protocol
● Problem
○ Encapsulate the datagram in a frame and know the @MAC of the destination of the frame
To whom should the frame be sent?
FRAME
The routing table says so!!!
PC1 routing table
Destination/mask interface
It is necessary to send via e0 to
the gateway 10.0.0.1
Lucas Bazilio - Udemy
Address Resolution Protocol
● PC1 sends a broadcast ARP request on its network asking for the @MAC of 10.0.0.1
● R1 updates its ARP table with the association of @IP and @MAC of PC1
The @MAC of the gateway
10.0.0.1 is asked
ARP Table of R1
duration
Lucas Bazilio - Udemy
Address Resolution Protocol
● R1 answers with an ARP reply
● Contains resolution 10.0.0.1 – AA-00-00-12-34-56
● PC1 updates its table
ARP Table of PC1
Contains the @IP-@MAC
duration resolution of the router
ARP Table of R1
duration
Lucas Bazilio - Udemy
Address Resolution Protocol
● PC1 encapsulates the datagram for PC3 in a frame destined for the @MAC of the router
frame is sent to router
Lucas Bazilio - Udemy
Address Resolution Protocol
● The router checks the destination @IP and sees from its routing table that the destination
is directly connected to its other network.
The router checks the destination @IP
The frame arrives at
the router
Lucas Bazilio - Udemy
Address Resolution Protocol
● The router transfers the datagram to its exit interface
● The router must now add a new frame header to transmit to the destination
● The router checks its ARP table to see if it can find the @MAC of 10.0.1.10
The first time a datagram
arrives for PC3, the router does
not know the @MAC of PC3
Lucas Bazilio - Udemy
Address Resolution Protocol
● If this is your first time transmitting to PC3 or too much time has passed since you last
transmitted to PC3, the router should discover the @MAC of PC3
● The router sends an ARP request in broadcast
Datagram waiting
The router asks about the
@MAC of 10.0.1.10
Lucas Bazilio - Udemy
Address Resolution Protocol
● PC3 updates its ARP table with the @MAC of the router
● PC3 replies with an ARP reply containing its resolution.
Datagram waiting
R1 ARP Table
duration
Contains the @IP-@MAC
resolution of PC3
PC3 ARP Table
duration
Address Resolution Protocol
● The router can finally take the waiting datagram, encapsulate it in a frame with
destination PC3 and send it
duration
Lucas Bazilio - Udemy
Address Resolution Protocol
● What if there were more intermediate networks?
➔ Same thing
➔ PC1 checks if it has the @MAC of 10.0.0.1 (gateway to PC5) in the ARP table
◆ If it already has it from previous resolutions, it encapsulates the frame and sends
◆ If it does not have it, ARP request and wait for the ARP reply with the response
◆ Encapsulates the datagram in the frame and transmits to router R1
Lucas Bazilio - Udemy
Address Resolution Protocol
● What if there were more intermediate networks?
➔ R1 receives the frame, removes the frame header, moves the datagram to its other
network, and checks if it has the @MAC of 10.0.2.2 in its ARP table
◆ If it already has it from previous resolutions, it encapsulates the frame and sends
◆ If it does not have it, ARP request and wait for the ARP reply with the response
◆ Encapsulates the datagram in the frame and transmits to router R2
Lucas Bazilio - Udemy
Address Resolution Protocol
● What if there were more intermediate networks?
➔ R2 receives the frame, removes the frame header, moves the datagram to its other
network, and checks if it has the @MAC of 10.0.3.30 (final destination) in your ARP table
◆ If it already has it from previous resolutions, it encapsulates the frame and sends
◆ If it does not have it, ARP request and wait for the ARP reply with the response
◆ Encapsulates the datagram in the frame and transmits to PC5
Lucas Bazilio - Udemy
Other ARP functions
● Reverse ARP
○ Find out the destination @IP from @MAC (as opposed to ARP)
● Gratuitous ARP
○ A host sends a broadcast ARP request in this way
Asks who has 10.0.0.10
what is it for?
Find out if PC1's @IP is already busy on the 10.0.0.0/24 network
If someone answers, it means that they have the same @IP as PC1
→ Duplicated @IP !!!
Lucas Bazilio - Udemy