HarryMuscle
Senior Member
Is it possible in a script to get the IP address of a device on the network if you know its MAC address?
Thanks,
Harry
Thanks,
Harry
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?
Is it possible in a script to get the IP address of a device on the network if you know its MAC address?
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).Parse the content of /proc/net/arp .
grep -i "AA:BB:CC:DD:EE:FF" /proc/net/arp | awk -F ' ' '{if ($3 != "0x0") {print $1,$4}}'
We use essential cookies to make this site work, and optional cookies to enhance your experience.