The IP address of a networked device is its numerical identification. It serves as an address to ensure that the correct network traffic is sent to the correct device. However, most hardware on LANs has a dynamic IP address. A network administrator might be familiar with the ARP protocol. ARP is a protocol that Layer 2 hardware uses to locate and connect to each other. This protocol is used by the arping utility. We have mentioned below the steps to use arping command in Linux.
Steps to use arping command in Linux
Arping on Linux
Arping is a common tool used by network administrators. However, it is not part of the Linux distribution’s standard toolkit. As a result, arping must be installed manually. Fortunately, arping is a widely used tool. It should be directly accessible from the official package servers, no matter what distro you use. Run the following command according to your distribution. Step 1: For Debian/Ubuntu and derivatives, the net-tools package is required for the arp tool: Step 2: For Fedora and derivatives: Step 3: For openSUSE and derivatives:
Using arping
discover hosts
When multiple devices are connected to Ethernet, the systems already have an internal ARP database for network communication. Arping can be used to list each entry on the network. Step 1: Run the following command to do this:
Ping Hosts
Step 1: If you know the IP address of the target device, you can simply pass the address to arping to perform an ARP ping. Step 2: Arping also allows you to set the number of times to ping the target device. To do this, use the “-c” flag, followed by the number of pings to be performed. If a new device is identified, you must run the following command to update the ARP table:
ARP Timeout
Step 1: If arping cannot resolve the target’s IP address, it will cause an ARP timeout. To demonstrate, run the following command. The IP address must be something inaccessible.
Specify network interface
Arping recommends that you specify the network interface, as you can see in the previous section. If the server has many network interfaces, this is extremely important. Arping cannot infer which network card to use. We can explicitly provide the network interface for arping to work around this issue. When using this method, arping will use the given network interface instead of speculating. Step 1: First, list all available network interfaces with the following command: Step 2: Then specify the network interface to arping using the “-I” flag as shown below:
Specify source MAC address
Step 1: As in the previous method, it is also possible to specify the MAC address of the source from which you are sending the packets. To achieve this, use the “-s” flag, followed by the desired MAC address, as follows: Step 2: The good thing is that arping can be performed in promiscuous mode. To enable this mode, use the “-p” flag. The command will look something like this:
Specify source IP address
Arping also gives you the option to explicitly specify the source IP address, which is intriguing. feature🇧🇷 This approach works very similarly to the previous phase. This approach, however, has its own drawbacks. The device will respond back to the IP address you explicitly specified after sending pings to it. Arping will not receive responses if the IP address is not yours. Step 1: To set the source IP address manually, use the “-S” flag. Step 2: If your situation matches the second option, use the “-p” flag to enable promiscuous mode.
Arping Help
Step 1: While these are the most commonly used arping commands, there are more. features what arping offers. For example, arping offers a quick help page for real-time documentation: Step 2: If you are interested in obtaining detailed information about the features of arping, you can dive deeper in the man page:
Final Words
We hope you enjoy our article on how to use the arping command on Linux. The system ARP cache is manipulated using the arp command. Also, a complete dump of the ARP cache is possible. The Address Resolution Protocol is known as ARP. The main purpose of this protocol is to translate a system’s IP address into its MAC address; as a result, it operates between level 2 (data link layer) and level 3 (network layer).