# ARP and RARP

### ARP and RARP: Understanding Address Resolution

**ARP (Address Resolution Protocol):**

ARP is a communication protocol that translates a device's **logical IP address** (e.g., 192.168.1.10) to its corresponding **physical MAC address** (e.g., 00:11:22:33:44:55) on a local area network (LAN). It acts like a phonebook for your network, mapping IP addresses to their hardware counterparts.

**How ARP Works:**

1. **Sending Data:** When a device (A) on a network wants to communicate with another device (B) using its IP address, device A doesn't know the physical MAC address of device B.
2. **ARP Broadcast:** Device A broadcasts an ARP request packet on the network containing the target IP address (of device B) and asking for the corresponding MAC address.
3. **Response:** All devices on the network receive the ARP request. Only device B, recognizing its own IP address in the request, responds with an ARP reply packet containing its MAC address.
4. **Communication Established:** Device A receives the ARP reply, learns device B's MAC address, and can now directly communicate by including the MAC address in the data packets it sends to device B.

**Benefits of ARP:**

* Enables communication between devices using IP addresses, which are easier to remember and manage than MAC addresses.
* Improves network efficiency by caching ARP entries for recently communicated devices, reducing the need for frequent broadcasts.

**RARP (Reverse Address Resolution Protocol):** (Less common than ARP)

RARP is a less commonly used protocol compared to ARP. It performs the opposite function, translating a device's **physical MAC address** to its **IP address**. RARP is typically used in situations where a device, like a diskless workstation, boots up and needs to obtain its IP address before it can participate on the network.

**Commands to view ARP Cache:**

* **Windows:**
  * Open a Command Prompt window (search for "cmd" in the Start menu).
  * Type `arp -a` and press Enter. This will display the ARP cache, showing mappings between IP addresses and MAC addresses.
* **Linux:**
  * Open a terminal window.
  * Type `arp -a` and press Enter. This will provide a similar output to the Windows command, displaying the ARP cache.

**Additional Notes:**

* ARP and RARP are essential protocols for enabling communication on LANs.
* While RARP is less frequently used, understanding both protocols provides a more comprehensive understanding of network address resolution mechanisms.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://moharat.gitbook.io/cylabs/101-series/networking-101/arp-and-rarp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
