8.7 TCP/IP Utilities
8.7.3 ARP, RARP, NSLOOKUP
Address Resolution Protocol (ARP) is the means by which networked computers map Internet Protocol (IP) addresses to physical hardware (MAC) addresses that are recognized in a local network. ARP builds and maintains a table called the ARP cache, which contains these mappings (IP address-MAC address). The ARP cache is the means by which a correlation is maintained between each MAC address and its corresponding IP address. ARP provides the protocol rules for making this correlation and providing address conversion in both directions.

There are several switches that can be used with the ARP command:

  • arp -a – Displays the cache
  • arp -s – Adds a permanent IP-to-MAC mapping
  • arp -d – Deletes an entry from the ARP cache

There are other switches included with specific vendor implementations of ARP.

RARP
Machines that do not know their IP addresses use Reverse Address Resolution Protocol (RARP). It is used to obtain IP address information based on the physical or MAC address. RARP provides the rules by which the physical machine in a LAN can request to learn its IP address from a gateway server Address Resolution Protocol (ARP) table or cache. A gateway server is a computer or router that is configured to receive information from computers in the local network and send it to computers in a remote location such as the Internet or other areas in a large internetwork.

Note: ARP maps IP-to-MAC addresses. RARP is the reverse of ARP. It maps MAC-to-IP addresses

NSLOOKUP.EXE
Another utility, nslookup, returns the IP address for a given hostname. It will also do the reverse and find the host name for a specified IP address. For example, entering "cisco.com", would deliver 198.133.219.25, which is the Cisco IP address. Entering "198.133.219.25", would deliver "cisco.com".