ARP and RARP
ARP (Address Resolution Protocol) in charge of learning what is the MAC address (i.e., the physical address) of a computer that has a given IP address and RARP (Reverse Address Resolution Protocol) does the opposite: it is in charge of finding out what is the IP address of a computer with a given MAC address.
While a datagram is being transmitted over the Internet the MAC address of the target computer is not needed – the routers in the middle of the road are only interested in delivering the datagram to the target network. But once the packet arrives the target network, the router connected to that network needs to know the MAC address of the target computer, as it will deliver the datagram locally (probably using the Ethernet protocol).
For example, if the target IP address is 188.8.131.52, when the datagram arrives at the router of the 184.108.40.206 network, it will ask to all computers (when a message is sent to all computers it is called broadcast message) using ARP protocol: “hey, which computer is 220.127.116.11?”. Then the computer that is using this IP address will answer “that’s me!”.
Of course sending broadcast messages all the time congests the network, so the router will keep a table of known IP addresses and their corresponding MAC addresses, so it won’t need to ask the same question again when it receives a new datagram targeted to 18.104.22.168.
RARP, on the other hand, was used in the past by PCs without a hard disk drive or any other boot media using remote boot. Since this kind of computer don’t have an operating system installed, they don’t know which IP address they are going to use, so they need to know which IP address they should use in order to start loading the operating system from the remote boot server. As you can see, this is exactly the same role as DHCP and since nowadays all networks use a DHCP server, the use of RARP became obsolete.
Both ARP and RARP work on the Network Interface layer.