6

How could I send ARP packet to specified IP on a LAN using bash or some Linux utility?

1 Answers1

6

This can't be done with the bash shell but with a dedicated command run from a shell. On Linux arping is the dedicated command for this.

Example, on a system with a single network interface (so interface guessing can't be wrong) to send an ARP to a remote system with IPv4 address 192.0.2.2 (which is supposed to be in the same LAN):

arping 192.0.2.2

This command comes in two flavors: the original arping and iputils' arping. Their syntax and features differ, only the basic usage is the same. Depending on the variant or on the distribution, this command might require root to run it and would then be placed in /usr/sbin/ rather than /usr/bin/ (when placed in /usr/bin/ the command has additional privileges, such as CAP_NET_RAW to allow it to craft ARP packets when run by a normal user). I would probably choose the iputils variant if given the choice.

A.B
  • 6,306