0

I use the following script to query for the ARP table. However, I only want to execute this script when the ARP table changes instead of periodically (cron job). How can I achieve this? Also can the command below keep the ARP table on server updated?

arp | grep -v 'incomplete' | tail
ByteNudger
  • 1,545
  • 5
  • 29
  • 37
nullox
  • 295
  • 2
  • 7
  • 18

1 Answers1

0

Updated answer

I found the ip(8) command in the iproute2 package does exactly what you want! CONFIG_ARPD turned out to be irrelevant to this (it was even removed from the kernel at Linux 3.12.)

Run ip monitor neigh and watch its output.

But I felt the ARP table is changed rather frequently... (cf. Configuring ARP age timeout )

Anyways please disregard my old answer below.

Old answer

I think your Linux kernel must have the CONFIG_ARPD option enabled (try grep CONFIG_ARPD /boot/config-*) to support such operations. And if so, you need to write C program to receive the information.

Community
  • 1
  • 1
nodakai
  • 7,773
  • 3
  • 30
  • 60