The IP address is used to address different hosts in a network with different identities. The MAC address is used to identify different network interfaces in a local area network or LAN. Even IP address is the global way to find a host in the last step of transmission the MAC address is used to identify hosts by translating the IP address into the MAC address. In this tutorial, we examine how to find the MAC address of a host or network interface card by using its IP address.
Find MAC Address via ARP Protocol and Table
In a operating system like Windows , Linux, MacOSX etc. network stack stores the IP address and MAC address relations in a table named
ARP Table . The ARP is a protocol used to resolve IP addresses into MAC addresses and named after “Address Resolution Protocol”. First we should communicate with the destination hosts IP address by simply ping to it. This ping command triggers the ARP protocol and the IP address and MAC address resolution is stored in the ARP table.
Now we list the ARP table with the
arp command by providing the
-a option to list all entries in the ARP table.
Find MAC Address via Windows GetMAC Command
Windows operating systems provide the NetBIOS protocol as an management and information sharing protocol. This protocol can be used with the
getmac command in order to get remote computer MAC address. Keep in mind that the remote computer should be a Windows operating system like Windows XP, Windows 7, Windows 8, Windows 10 or Windows Server. This command do not works with the other operating systems like Linux. The
/s option and the remote computer IP address are provided to the getmac command.
getmac /s 192.168.136.128
If the remote host operating system is Non-Windows like Linux, MacOSX, Android, iOS, etc. the following error is returned.
ERROR: The RPC server is unavailable.
Find MAC Address via Linux arping Command
The Linux distributions like Ubuntu, Debian, Mint, Kali, CentOS, RHEL etc provides the
arping command which name is derived from the ping command. The arping command simply pings the remote system by using the ARP protocol. It is not installed by defualt for the most of the Linux distributions and can be installed like below.
Install arping In Ubuntu, Debian, Mint, Kali:
sudo apt install arping
Install arping In CentOS, RHEL, Fedora:
sudo dnf install arping
The arping command requires root privileges as it is a low-level tool and also the IP address of the remote host is provided.
$ sudo arping 192.168.136.128
As we can see from the output arping provides very similar behaivour to the ping command. It runs continously and prints returned arping responses and related information like packet size, MAC address, IP address, ping packet index and round trip time.
Find MAC Address via Linux,Windows nmap Command
The nmap command is very common amongst system administratırs, network administrators and penetration testers to scan hosts. The nmap command can be also used to find MAC address via provided IP address. The nmap can be called with the
-sP options to list provided IP addreess MAC address.
nmap -n -sP 192.168.136.128