What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Get IP of Device With Specific MAC Address in Script?

Is it possible in a script to get the IP address of a device on the network if you know its MAC address?
Parse the content of /proc/net/arp .
 
Is it possible in a script to get the IP address of a device on the network if you know its MAC address?
Parse the content of /proc/net/arp .
If choosing this method, keep in mind that in the script you'll have to filter out any ARP cache entries that have the flag=0x0 (3rd entry from the left) which indicates that the entry is currently "incomplete" (i.e. it should be ignored).

For example:
Bash:
grep -i "AA:BB:CC:DD:EE:FF" /proc/net/arp | awk -F ' ' '{if ($3 != "0x0") {print $1,$4}}'

My 2 cents.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top