Saturday 16 April 2011

How to find MAC address of PC/device In Your Network

The MAC address of other PCs in LAN can be quite useful for some network protection bypassing such as internet access, etc. Today, I will show you how you can find the MAC address of any PC in your network.

Method 1: This method works in both windows and Linux. So open your terminal(in linux) or command prompt(in windows) and type:

ping <hostname>

Here, in place of <hostname>, type either computer's name or IP address whose MAC address you want to know.

Now, type the following command:

arp -a <hostname>

This will give you the arp entry cache of the specified hostname and this information also includes the MAC address of the PC. Sample output would be something like below:

techgaun.local (192.168.0.49) at 90:fb:a6:27:b7:6a [ether] on eth1

You can clearly spot the MAC address in the above output.

Method 2: This method is pretty useful and I do frequently use this tool to gather NetBIOS information of PCs in network. The tool I use is nbtscan and nbtscan is a program for scanning IP networks for NetBIOS name information. It sends NetBIOS status query to each address in supplied range and lists received information in human readable form. For each responded host it lists IP address, NetBIOS computer name, logged-in user name and MAC address (such as Ethernet).

The tool is available for download for windows and different distros of Linux from HERE.

Also, you can install it under ubuntu by issuing following command from terminal.

sudo apt-get install nbtscan

Now, the usage of this tool is pretty straightforward.

nbtscan <hostname>

This will give the NetBIOS information of the requested hostname. But, this isn't the only thing. We can also mass-scan the network by giving the IP range.

nbtscan 192.168.0.1-255

This scans all the devices within the range 192.168.0.1 - 192.168.0.255 and displays the NetBIOS information of the computers in network.

I hope this helps some of you. Thanks :)