ARP - CMD
Overview
The ARP command in Windows is used to display or modify entries in the ARP cache. The ARP (Address Resolution Protocol) cache is a table that stores mappings between IP addresses and MAC addresses. This command is primarily used for diagnostic and network troubleshooting purposes, allowing users to view and manipulate the information that controls the translation between IP addresses and MAC addresses on the local network.
Syntax
The basic syntax for the ARP command is as follows:
arp [-a [inet_addr] [-N if_addr]] [-g [inet_addr] [-N if_addr]] [-d inet_addr [if_addr]] [-s inet_addr eth_addr [if_addr]]
Where:
inet_addrspecifies an internet address.eth_addrspecifies a physical address.if_addris the interface address.
Options/Flags
- -a: Displays current ARP entries by interrogating the current protocol data. If
inet_addris specified, the command displays the ARP entries for the specified IP address. - -g: Identical to -a.
- -d: Deletes the host specified by
inet_addr. Theif_addris optional and specifies the interface address where the deletion is to occur. Use*to delete all hosts. - -s: Adds the host and associates the Internet address
inet_addrwith the Physical addresseth_addr. The physical address is given as 6 hexadecimal bytes separated by hyphens. The entry is permanent unless removed manually.
Examples
-
Viewing all ARP entries:
arp -aThis command displays all ARP entries for all interfaces.
-
Viewing ARP entries for a specific interface:
arp -a -N 192.168.1.1Replace
192.168.1.1with the IP address of the interface you want to check. -
Adding a static ARP entry:
arp -s 192.168.1.120 00-aa-00-62-c6-09This command adds a static ARP entry associating IP address
192.168.1.120with the MAC address00-aa-00-62-c6-09. -
Removing an ARP entry:
arp -d 192.168.1.120This command deletes the ARP entry for the IP address
192.168.1.120.
Common Issues
- Permissions: Users might encounter permission errors if they do not run the command with administrative privileges.
- Invalid Entries: Errors while adding incorrect IP or MAC addresses. Ensure the formats are correct and valid in your network environment.
Integration
ARP can be combined with other network diagnostic tools for comprehensive troubleshooting and monitoring:
-
Combining with
ping:ping 192.168.1.120 && arp -aThis will check the connectivity to the IP and show the ARP entry, helping diagnose network issues.
-
Scripting ARP checks:
@echo off for /f "tokens=*" %%a in ('arp -a') do ( echo %%a )This batch script iterates through all ARP entries, echoing them to the terminal.
Related Commands
- ping: Sends ICMP Echo Requests to network hosts.
- ipconfig: Displays all current TCP/IP network configuration values and refreshes DHCP and DNS settings.
For more information, refer to the Microsoft Documentation on ARP.