I have an IP address of a computer which I am currently away from, and I need the MAC address. How do I get the MAC address if I ony have the IP?
-
1possible duplicate of [Resolving an IP address of a Remote machine to its MAC address](http://security.stackexchange.com/questions/4493/resolving-an-ip-address-of-a-remote-machine-to-its-mac-address) – Gilles 'SO- stop being evil' Jul 30 '14 at 14:43
-
1@Gilles, That question is related to email. The answers in both threads differ. – Pacerier Nov 10 '15 at 11:08
-
Might be easy if it's an IPv6 address (sometimes MAC addresses are part of public IPv6 addresses). – Geremia Mar 16 '17 at 19:36
-
its unacceptable that this question is voted as Off Topic. Its actually lack of brains. – Denis Mar 29 '18 at 07:42
2 Answers
If you are on the same network you can open up a Terminal:
ping your_ip_address
hit Ctrl-C on the keyboard to stop pinging then do a:
arp -a
a list should appear, look for the ip you just pinged and next to it is the MAC address of the device.
-
7
-
-
Does this works on Linux? Tried and definitely works on windows 10. – Syaiful Nizam Yahya Sep 08 '16 at 08:04
-
-
-
-
for whatever reason my IP address is not in the list generated by `arp -a` – geneorama Jan 24 '17 at 19:51
-
-
5This only works if both hosts are on the same network, if it is in a virtual network for example it will not work – Alexandre Neukirchen May 19 '17 at 14:08
-
3As one command, and suppressing the ping output and irrelevant MAC addresses: `IP=192.168.0.118; ping -c 1 "$IP" >/dev/null && arp -a | grep "$IP"` – tanius Mar 31 '18 at 16:25
In short the answer will be you can't.
It is usually not possible for a person to get the MAC address of a computer from its IP address alone. These two addresses originate from different sources. Simply stated, a computer's own hardware configuration determines its MAC address while the configuration of the network it is connected to determines its IP address.
However, computers connected to the same TCP/IP local network can determine each other's MAC addresses. The technology called ARP - Address Resolution Protocol included with TCP/IP makes it possible. Using ARP, each computer maintains a list of both IP and MAC addresses for each device it has recently communicated with.
- 332
- 3
- 8
-
5And that short answer is wrong. One can **always** do an ARP lookup to determine the MAC of an IP. The only thing is that you probably are not seeing the actual IP of a device (due to NAT), if you're on separate networks. – antichris Jul 30 '14 at 09:42
-
10The above comment is wrong. If you do an ARP lookup for an IP that's not on the same network, you will generally get no reply. There are some cases where ARP masquerading is configured and *will* reply, but it's quite rare to do that as it causes other problems. – pjc50 Jul 30 '14 at 09:49
-
3@pjc50 Getting no replay does not prevent one from attempting an ARP lookup. My main point is that you can **always** do a lookup. And, if you're on the same network, you will **always** get what you were looking for. That's how the Ethernet protocol works. Otherwise there would be no IP packet exchange on the network, because NICs would not be able to resolve IPs to MACs. – antichris Jul 30 '14 at 09:53
-
5@U-D13 `I have an IP address of a computer which I am currently away from` ,in the question probably meant that the user is trying to find the MAC address of a computer which is not on the same network. So in that case the answer is right – Shiva Jul 30 '14 at 09:57
-
3@Shiva "probably meant". I can be away from my colleagues computer, but we're on the same network. I can be working from home via VPN and be away from my actual work machine, yet we're still on the same network. I strongly believe your answer should be reworded to clearly indicate that one can only resolve IPs to MACs in a local network, but one can **always** do that. – antichris Jul 30 '14 at 10:04
-
1@U-D13: Well If you didn't noticed ,its an accepted answer, so I believe , I did correctly get what the user meant in his question. And this was an answer not a wiki, to handle all possible corner cases. You can ask the user who posted the question what he meant rather that speculating what can be the meaning of 'What he meant' here. – Shiva Jul 30 '14 at 10:09
-
1You can, the method in the post below this one works: http://security.stackexchange.com/a/64291/70108 – unom Mar 12 '15 at 09:24
-
-
I feel like this answer could be made better just by saying "In **general** you can't", not "In short you can't". – mwfearnley Mar 18 '19 at 16:56
-
In general you can: **arp -a
** is indeed the correct way to go about this. Only works if the IP address you're looking up is on the same subnet as the machine you're searching from. – Rich M Oct 28 '21 at 13:16