Categories: TutorialsUbuntu

What is arp Command in Linux

Ubuntu is a Linux operating system (sometimes known as a distro). In Linux parlance, a distribution is a version of the operating system which is based on the Linux kernel. Hundreds of Linux distributions are available to choose from. Many are free and include user communities that offer one another advice and help. Downloading a free Linux distribution with few support options, on the other hand, can be frightening for the average computer user.

Sponsored

Ubuntu is a commercial project based on the Linux kernel that is distributed by the Canonical Corporation. Rather than charging for the operating system, Canonical makes money by providing commercial support for its products. It also aids corporations and organizations in the construction of efficient and effective computer systems.

The arp is an acronym for “Address Resolution Protocol,” and it modifies the ARP cache of the system. It also provides the opportunity to dump the entire ARP cache. It connects to IPv4 networks and converts an IP address into a physical address known as the MAC (Media Access Control) address for any other computer. This protocol runs at level 2 (data link layer) and level 3 (network layer) and is mostly used to resolve a system’s IP address to its mac address. In this article, we’ll go through the arp command and how to use it in Linux.

How to use arp command in Linux

This command is basically a networking command that transforms a machine’s IP address to its MAC address. The arp command is part of the net-tools program, thus if you don’t have the net-tools installed on your Linux, runs the following command to install them:

$ sudo apt install net-tools

To better understand how to use the arp command, consider the following scenario:

We can use arp commands to ping any other machine, let’s say in this case, a machine with the IP address 10.0.2.4 is being pinged using this command:

$ ping 10.0.2.4

You can execute the following arp command for the confirmation of the connection with the device with the IP address 10.0.2.4:

$ arp

It is confirmed in the given result that machine 10.0.2.4 is linked to our device. The parameters in the output are described as follows:

  • Address describes the machine’s IPv4 address.
  • In our scenario, the connection is made via Ethernet that’s why HWtype is defined as ether.
  • HWaddress describes the machine’s MAC address.
  • Mask of Flags basically indicates whether the address was manually extracted, user-defined, or incomplete. Some of the basic flags which will be useful in this regard are: -C(Complete entry), -M(Permanent entry) and –P(Published entry)
  • IFace describes the name of the user interface.

You can use the arp command with the “a” flag in the terminal in order to find the entries of a specific device, such as 10.0.2.4

$ arp –a 10.0.2.4

Sponsored

The IP address of the connected computer is presented together with its MAC address in the above output, and the connection is made through Ethernet on enp0s3.

Open the terminal and run the arp command with “v” flag in order to get detailed information about the device and its entries:

$ arp -v

You can execute the arp command along with the “-n” flag in order the arp’s output in numeric form:

$ arp -n

It is clearly seen that the “n” flag provides you with numerical representations of symbolic hosts, ports, and usernames.

How to Delete a device from arp List

Then, you can use the “-d” option to delete the device from the arp list:

$ sudo arp –d 10.0.2.4

You can run the arp command once again to confirm the machine’s removal:

$ arp 

From the above output, it is clear that machine 10.0.2.4 has successfully been deleted from the list of arp tables.

You can get more information about the arp command in the arp command manual, which can be accessible by using this command:

$ man arp

After pressing q, you can easily quit the manual:

Conclusion

When the protocol transforms IP to MAC, the arp command is used to determine the specifics of the linked devices. With the help of some examples, we have discussed the arp command and how it works in this article. We also go over the flags that can be used with the arp command on Linux to retrieve specific information.

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Ubuntu Server Admin

Recent Posts

Microsoft Edge Installation on Ubuntu 24.04

Microsoft Edge is now available for Ubuntu. In this guide, I’ll walk you through the…

5 hours ago

How we used Flask and 12-factor charms to simplify Canonical.com development

Our latest Canonical website rebrand did not just bring the new Vanilla-based frontend, it also…

12 hours ago

Web Engineering: Hack Week 2024

At Canonical, the work of our teams is strongly embedded in the open source principles…

1 day ago

Ubuntu Weekly Newsletter Issue 873

Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…

3 days ago

How to resolve WiFi Issues on Ubuntu 24.04

Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…

3 days ago

Remembering and thanking Steve Langasek

The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…

3 days ago