Share this post on:

During troubleshooting, it is often required to check a vendor of device in our arp / mac address table. Luckily, there’s a free API that we can query to check it.

Getting mac address list

Depending on the device, there are different commands to get mac-address or arp table. I’ll be using my linux laptop:

[root@centos ~]# arp -a

Let’s now extract mac address. I use awk to print a specific column and > to redirect output to the file

[root@centos ~]# arp -a | awk '{ print $4 }' > ip_list

Making API request

Once we’ve got the desired list of mac addresses, let’s check the vendor by looping through the file and making API call for each mac address.

while read ip; do
echo $ip
sleep 1
done <ip_list

We can simply save it to the file and make it executable. Let’s run the script.

[root@centos ~]# sh
Philips Lighting BVec-b5-fa-09-30-cb
AzureWave Technology Inc.40-99-22-2c-f2-a3
Cisco Systems, Incd4-8c-b5-0e-2a-a3
Hewlett Packardbc-ea-fa-d5-e4-7f
Cisco Systems, Inc54-78-1a-8e-5d-c1
Cisco Systems, Inc74-88-bb-59-10-d2

Ad-hoc request

We can make our script to take a command line arguments if we want to simply get a vendor of one mac address.


Let’s test it:

[root@centos ~]# sh d4-8c-b5-0e-2a-a3
Cisco Systems, Inc

Leave a Comment

Your email address will not be published. Required fields are marked *