title: Doing ARP and Inverse ARP on Linux 2.6.21 (glibc 2.3.5)
body: <p>I need to store persistent reference to third party device on an arbitrary IP network where the IP address of the devices may be static or randomly assigned by DHCP. I don't control the devices on the network and I can't rely on DNS and other ad-hoc networking protocols existing or working with the devices.</p>
  
  <p>So I have been instructed to investigate using hardware addresses and ARP. This will work but I don't want to duplicate code. The kernel must manage an ARP table. On Windows you can access it using <a href="http://msdn.microsoft.com/en-us/library/aa365956(VS.85).aspx" rel="nofollow noreferrer">GetIpNetTable</a> etc. </p>
  
  <p>I am hoping there is an API to answer these two questions:</p>
  
  <ul>
  <li>How do I translate from IP to MAC address? (ARP)</li>
  <li>How do I translate from MAC to IP address? (InARP)</li>
  </ul>
  
  <p>If not then I may have to do it more manually:</p>
  
  <ul>
  <li>How do I read the kernel's ARP table?</li>
  <li>How do I add an entry if I have the determined a mapping myself?</li>
  </ul>