52

I know the IP address of a host on my own LAN. Using that, how can I find its MAC address (without having to physically access it)?

Spiff
  • 110,156
Frederick
  • 779

11 Answers11

66

If you are on a Windows machine, open a command box (Start...Run...cmd), ping the target machine so you have made contact with it, and then issue the command arp -a to view your local ARP table, which will list IP addresses and their corresponding MAC addresses, e.g.,

C:\Users\L3K> arp -a

Interface: 192.168.200.128 --- 0xb
  Internet Address      Physical Address      Type
  192.168.200.1         00-50-7f-c3-5c-88     dynamic
  192.168.200.2         00-50-7f-d1-e1-40     dynamic
  192.168.200.6         00-80-77-dd-a8-6b     dynamic

If you are on a Linux-based system, install the arp-scan utility, and then from a command line you can ask for a scan of your network - in my case:

sudo arp-scan 192.168.200.0/24

If you are using an interface other than Ethernet, say, wireless, you will need to specify that, such as

sudo arp-scan -I wlan0 192.168.200.0/24

If you don't know what interface you're using, simply use the appropriate command below.

ifconfig  (For Debian based OS such as Ubuntu)
ip link   (For OS like Arch Linux)
Linker3000
  • 28,240
24

The command arping comes with the iputils package on linux. Specify an ip address to ping and it returns the MAC address, even across switches and subnets on the LAN (at least it does on our LAN).

# arping -c 1 -I eth0 10.100.10.11
ARPING 10.100.10.11 from 10.100.10.25 eth0
Unicast reply from 10.100.10.11 [00:22:68:88:F3:90]  0.594ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
Joe Zacky
  • 241
8

Try

getmac /s hostname

or:

getmac /s IP

You need admin access to the machine to do this.

slhck
  • 235,242
Patrick
  • 81
4

If both your machine and the target machine are on the same subnet, you can just ping it to cause its IP⟷MAC association to be registered via Address Resolution Protocol (ARP).

ping -c1 $IP
arp -n | grep $IP

for example if I want to find the IP of 10.1.135.150:

# ping -c1 10.1.135.150
PING 10.1.135.150 (10.1.135.150) 56(84) bytes of data.
64 bytes from 10.1.135.150: icmp_seq=1 ttl=64 time=1.88 ms

--- 10.1.135.150 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.883/1.883/1.883/0.000 ms

Then query the ARP table

# arp -n | grep 10.1.135.150
10.1.135.150             ether   8c:ae:4c:f4:4d:e1   C                     eth0

So the MAC of 10.1.135.150 is 8c:ae:4c:f4:4d:e1

RobM
  • 755
3

If you have a managed switch or your router lets you view its ARP table you can get this from there.

If the computer you have the IP for is online you can ping it and get its MAC from you local ARP table.

A general note for the sake of others: it is not possible to obtain the MAC address for machines that are on a different LAN since Layer 3 protocols are used for addressing and delivery in this case and MAC is Layer 2.

imoatama
  • 1,944
2

just use something like:

nmap -n -sP 192.168.146.0/24

after adapting the params to your setup this will scan your whole subnet giving IP and MAC addrs

sparkie
  • 2,268
1

As long as there is no gateway routing the traffic between the computers, any sniffer would give you this information.

Ofir
  • 1,504
1

You can use utility like http://trogonsoftware.com/trogon-mac-scanner.html or another ip\mac address scanner to scan network for addresses of remote computers on LAN.

boogoo
  • 11
0

You can always consult the arp table on your router (in some cases, the router combines the arp and dhcp lease tables together).

MaQleod
  • 13,258
0

Another way is:

nbtstat -a 192.168.1.1

(replace 192.168.1.1 with desired address)


Also, if getmac is used on a non-Windows computer, you'd get:

ERROR: The RPC server is unavailable.

Pacerier
  • 28,143
-2

The best way is to use ⇾ arp -a IPaddress