arp -a – View ARP Cache
What is ARP (Address Resolution Protocol)?
Definition: ARP (Address Resolution Protocol) is a protocol used in IPv4 networks to map (resolve) a device's IP address to its corresponding MAC address on a local network segment.
Purpose: ARP allows devices to communicate at Layer 2 (Ethernet) by discovering the MAC address associated with a given IP address.
Understanding ARP Cache
Definition: The ARP cache is a local memory table that stores mappings of IP addresses to MAC addresses, built from recent ARP traffic.
- Improves network efficiency by storing address resolutions and avoiding repeated ARP broadcasts for the same device.
- Speeds up communication by immediately providing the MAC address when sending packets to known IPs.
Using arp -a Command
| Platform | Command | Description |
|---|---|---|
| Windows | arp -a |
View ARP cache |
| Linux/macOS | arp -a or ip neigh show |
View ARP cache |
Interface: 192.168.1.10 --- 0x3
Internet Address Physical Address Type
192.168.1.1 00-14-22-01-23-45 dynamic
192.168.1.20 00-25-96-ab-cd-ef dynamic
192.168.1.30 00-13-ce-12-34-56 static
Interpreting ARP Cache Entries
| Field | Description |
|---|---|
| IP Address | The device's logical network address |
| Physical (MAC) Address | The hardware address used for Layer 2 communication |
| Type |
Dynamic: Learned automatically via ARP requests/replies Static: Manually configured; remains until manually removed or system restart |
Dynamic vs. Static ARP Entries
- Dynamic Entries: Created automatically when a device communicates with a new IP on the LAN. Automatically removed after a timeout (e.g., 2–10 minutes).
- Static Entries: Manually added using commands (e.g.,
arp -sin Windows). Useful for devices that should never change MAC addresses (e.g., servers, routers).
ARP Cache Aging
Timeout: Dynamic entries expire after a period of inactivity.
This ensures the ARP cache does not become stale or filled with outdated entries.
Common Uses of ARP Cache Information
- Troubleshooting connectivity issues
- Detecting duplicate IPs or MAC spoofing
- Verifying network changes (e.g., after replacing a router)
Clearing and Managing ARP Cache
| Action | Windows Command |
|---|---|
| Clear all dynamic entries | arp -d * |
| Clear a specific entry | arp -d 192.168.1.20 |
When to clear: After network changes, device replacements, or if the ARP cache contains outdated entries.
Limitations of ARP
ARP is unauthenticated and susceptible to spoofing attacks.
ARP Spoofing: A malicious actor sends fake ARP messages, associating their MAC with another device’s IP (e.g., gateway), allowing them to intercept traffic.
Mitigation Techniques
- Use Dynamic ARP Inspection (DAI) on managed switches
- Implement static ARP entries for critical systems
- Use secure protocols (HTTPS, SSH) to protect sensitive data even if ARP is compromised
Related Networking Concepts
- Proxy ARP: A router answers ARP requests on behalf of another device, making it appear as if multiple IPs are on the same subnet.
- Gratuitous ARP: A device broadcasts an ARP reply for its own IP (without a request), often used during IP address changes or failover for faster updates.
Practical Example
Troubleshooting Steps:
- Run
arp -a - Check for the entry of 192.168.1.1
- If missing, run
ping 192.168.1.1to force ARP resolution - If the MAC address looks wrong or matches multiple IPs, check for spoofing or misconfigurations
- If necessary, clear the ARP cache:
arp -d *and retest
Exam Tips and Key Points
- Know how to interpret
arp -aoutput: IP to MAC mapping and type (dynamic/static). - Understand ARP cache behavior: why entries age out, how to force or clear entries.
- Be aware of ARP’s vulnerabilities and basic mitigation.
- Relate ARP cache to real troubleshooting: device not reachable, duplicate IP, or wrong MAC addresses.
- Remember: ARP is only used on the local subnet; remote addresses are resolved via the gateway.
A. Sample Scenario: Detecting ARP Spoofing
Steps to Detect ARP Spoofing:
- Display the ARP Cache:
arp -a - Ping the Gateway Repeatedly, and run
arp -aperiodically. - If the MAC address for 192.168.1.1 changes between values, it's a sign of ARP spoofing or a network issue.
- Investigate further: run
arp -aon multiple devices, check for MAC flapping or port security violations on switches.
Mitigation (Best Practices)
- Enable Dynamic ARP Inspection (DAI) and port security on switches.
- Use static ARP entries for essential servers/gateways, but do so carefully to avoid operational issues.
B. Adding and Removing Static ARP Entries
| Action | Command (Windows Example) |
|---|---|
| Add a static entry | arp -s 192.168.1.50 00-aa-bb-cc-dd-ee |
| Remove a static entry | arp -d 192.168.1.50 |
Exam & Real-World Tips
- Static ARP: Useful for short-term fixes or test labs, but not scalable for large environments.
- ARP Spoofing Detection: Look for MAC address changes or inconsistencies in
arp -aoutput. - Clearing ARP Cache: Run
arp -d *to refresh mappings after network changes.