Ubuntu ARP Command Guide: Inspect and Manage MAC Address Tables

Overview

Diagnosing local network anomalies and conducting hardware-level security audits require a firm understanding of the Address Resolution Protocol (ARP). This protocol translates network-layer IP addresses into link-layer MAC addresses. In this hands-on tutorial, we explore practical techniques on Ubuntu for examining local ARP tables, provisioning static mappings for security hardening, and flushing obsolete cache entries using traditional and modern Linux networking utilities.

Installing net-tools and Querying the Default ARP Cache Table

Because modern distributions streamline standard installations, the legacy arp tool is not always pre-installed. We begin by provisioning the net-tools package alongside standard diagnostic utilities like iputils-ping.

Installing net-tools and iputils-ping via apt

Before analyzing neighboring nodes, verify that the local TCP/IP networking stack responds correctly by dispatching two ICMP echo requests to the loopback interface (127.0.0.1).

Verifying loopback interface connectivity with ping

Executing arp -a displays all active mappings between Layer 3 IP addresses and physical Layer 2 hardware addresses using the traditional BSD-style presentation format.
⚙️ [Primary Command Flags]

-a : Formats and prints the entire cached mapping list in classic BSD syntax.
-v : Generates verbose operational logs along with statistical summaries of cache hits.
-n : Prevents DNS reverse lookups and forces output to render as raw numeric IPs.
-d : Purges the designated host binding from the operating system’s ARP table.
-s : Manually binds a target IP address to a static physical MAC address.
-i : Restricts cache inspection or modification strictly to an explicit network adapter.

Listing current ARP cache records with arp -a

Passing the verbose flag via arp -v exposes extra runtime diagnostics, detailing the total count of recognized neighbor entries alongside query execution statistics.

Inspecting cache statistics using verbose output

Numeric IP Output and Deciphering Status Flags

Running arp -n avoids latency caused by slow or unresponsive reverse DNS lookups by printing raw IP addresses instead of resolving domain names.
This straightforward listing accelerates incident analysis, instantly revealing hardware identifiers along with completion status markers like the Complete (C) flag.

Viewing numerical IP-to-MAC associations via arp -n

Alternatively, invoking arp -e switches the output into the standard Linux layout. When name resolution succeeds, it substitutes IP addresses with hostnames (such as bsk-mint).
This view clearly breaks down the bound network interface (eth0), device hardware category (ether), and MAC address within an organized tabular schema.

Displaying standard Linux formatted records via arp -e

To verify whether outbound traffic routes through an upstream gateway, inspect the kernel routing configuration with ip route show | grep default.
An empty response signifies that this isolated sandbox operates without an assigned default gateway, confining interactions strictly to the broadcast segment.

Checking for an active default gateway route

Configuring Static ARP Entries and Validating Mappings

Issuing arp -s 192.168.100.50 00:11:22:33:44:55 writes an unalterable static association between the target IP (192.168.100.50) and the designated hardware address (00:11:22:33:44:55).
Manually pinning critical gateway or server entries mitigates exposure to ARP poisoning and man-in-the-middle (MITM) spoofing attacks while stabilizing isolated testing environments.

Creating a manual static ARP binding

Pipe the output through grep (arp -a | grep 192.168.100.50) to verify that the manual entry registered correctly across the kernel cache.
The resulting entry confirms that the manual binding persists with the permanent flag applied.

Confirming the newly registered static mapping

Removing ARP Records and Exploring the Modern ip neigh Utility

When an endpoint changes network interface cards or moves to another subnet, discard its outdated binding using arp -d 192.168.100.50.
Linux silently drops the record upon successful execution, leaving the prompt without error alerts.

Deleting a specific cached entry from the table

A subsequent check with arp -n demonstrates the updated state of the internal cache table.
The manually defined 192.168.100.50 node is gone, leaving only legitimate dynamic entries active across the interface.

Validating table cleanup after entry deletion

In modern environments, the iproute2 package supersedes outdated net-tools commands. The standard contemporary replacement for querying neighbor discoveries is ip neigh show.
Because our test environment currently maintains no active broadcast conversations or unresolved neighbors, the command exits cleanly with no rows returned.

Querying neighbor tables with the modern ip neigh command

Mastering both classical arp parameters and contemporary ip neigh syntax empowers administrators to swiftly pinpoint connectivity bottlenecks and monitor endpoint integrity across local Ubuntu segments. Incorporate these utilities into your regular networking toolkit whenever diagnosing hardware mismatches or securing subnets against spoofing vulnerabilities.