Tuesday, April 02, 2013

Getting client MAC Address Remotely on Linux

Tech Blog - This is a simple way of getting client MAC address remotely on a Linux machine provided you know the client IP address, this is very useful specially when setting up fixed addresses on dhcpd.conf, wherein you want to map static IP address to MAC address.

First we install nmap from the yum repository, if your using Cent OS | RHEL | Fedora, in may case I am using Cent OS 6.

yum install nmap.i686

After nmap has been installed, use the command below to find out the mac address mapped to the IP.

# nmap -sP 192.168.1.98

Starting Nmap 6.25 ( http://nmap.org ) at 2013-04-01 09:50 PHT
Nmap scan report for desktop12 (192.168.1.98)
Host is up (0.00016s latency).
MAC Address: C8:60:00:D0:69:5F (Asustek Computer)
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

If you have no idea what the client IP is you can also use nbtscan if the client are Windows machine to find out any useful information.

# nbtscan -v -s : 192.168.1.0/24
192.168.1.0    Sendto failed: Permission denied
192.168.1.98:WORKGROUP      �:00G
192.168.1.98:PCD  �:00U
192.168.1.98:PCD  �:20U
192.168.1.98:WORKGROUP      �:1eG
192.168.1.98:WORKGROUP      �:1dU
192.168.1.98: __MSBROWSE__ �:01G
192.168.1.98:MAC:c8-60-00-d0-69-5f
*** stack smashing detected ***: nbtscan terminated

If nbtscan is not installed, just do a search on your yum repository and install the package.

No comments:

For suggestion and concerns E-mail