I need to find a solution how to get the MAC address from the other device in the WiFi network. There is a good method how to do this for IPv4 (How does iOS app Fing get MAC Address?), but how to do this for IPv6? Since ARP was replaced by the NDP (Neighbour Discovery Protocol), the latter method doesn't work. I would greatly appreciate if anyone could help me.
-
If you look at how NDP works, each host on a network subscribes to a Solicited Node multicast address, which is based on its IPv6 address. You can send a Neighbor Solicitation message to either the IPv6 address or the Solicited Node address. It should be fairly trivial to craft this in your application. _[RFC 4861, Neighbor Discovery for IP version 6 (IPv6)](https://tools.ietf.org/html/rfc4861#section-4.3)_ gives you the message formats to use for this: – Ron Maupin Feb 25 '17 at 19:34
-
@RonMaupin could you provide an actual answer with some detail? – Richard Chambers Apr 30 '17 at 11:58
-
1Do you mean write the code for you? I don't think so... – Ron Maupin Apr 30 '17 at 15:08
-
@RonMaupin an answer would not need actual code but would need sufficient design details so that someone else could write the code. Since currently this question is unanswered yet people are interested in an answer, I decided to offer up some of my hard earned reputation for an answer from someone. Since you provided a comment pointing to a starting place, you seemed the logical person to approach for an actual answer that would provide more than just a hint to get started. There is a large gap between a starting hint and the actual code and I merely ask for assistance in filling that in. – Richard Chambers Apr 30 '17 at 21:44
2 Answers
Layer and Encapsulation
The network architecture is layered, the upper layer encapsulate the different implementations of lower layer and provide higher abstraction relative to lower layer. The network layer which use IP encapsulate different link layers protocols, like Ethernet, WiFi, PPP (which may run on serial cable which not use MAC address) etc.
- So, the first problem is what do you mean by
remote
?
If you mean other hosts in WAN, it is impossible unless both device implement a specific protocol: you send a request to those device, they reply with his mac address.
If you mean other host in the same LAN, you can use ARP protocol in IPv4 and NDP (which ) in IPv6.
Arp & NDP
ARP send broadcast in LAN when it knows the IP address of a host but not MAC address, then the hosts which find someone is calling for him reply its MAC address.
NDP provides two main part of functionality, the first is the same with ARP: mapping between network- and link-layer addresses. (The difference is NDP using a multicast address: prefix f02::1:f/104, combined with the low-order 24 bits of the solicited IPv6 address)
So what you need is to send ICMPv6 Neighbor Solicitation message.
Address Assignment in IPv6
Link-local IPv6 addresses (and some global IPv6 addresses) use interface identifiers (IIDs) as a basis for unicast IPv6 address assignment. ... IIDs are ordinarily 64 bits long and are formed either directly from the underlyinglink-layer MAC address of a network interface using a modified EUI-64 format. or by another process that randomizes the value in hopes of providing some degree of privacy against address tracking.
So in the most common cases, you can get the MAC address of a device directly from their IPv6 link local address.
Conclusion:
- implement your protocol in both devices
- send NDP message to solicited node if it is in same LAN
- extract MAC address from link local IPv6 address
Ref
- Wikipedia
- TCP/IP Illustrated, volume 1

- 5,972
- 2
- 39
- 58
-
Thank you, Tony I will accept your answer as the most helpful in this situation. – Max Niagolov May 06 '17 at 13:22
-
"_In the WiFi environment, the router you connected always do NAT, which make your LAN area very limited, maybe the device you are interested not in same LAN with you._" IPv6 doesn't have NAT, so I'm not sure what NAT has to do with the question. – Ron Maupin May 06 '17 at 16:19
-
[Everything you need to know about IPv6](https://arstechnica.com/gadgets/2007/03/ipv6/) describes why NAT exists in IPv4 and why it is not necessary with IPv6. See as well [Supporting IPv6 DNS64/NAT64 Networks](https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html) and [IPv6 Security Myth #3 – No IPv6 NAT Means Less Security](http://www.internetsociety.org/deploy360/blog/2015/01/ipv6-security-myth-3-no-ipv6-nat-means-less-security/). – Richard Chambers May 06 '17 at 20:45
-
1See as well this article from a thesis from someone at the University of Twente, [Impact of IPv6 on WiFibased networks](https://www.utwente.nl/ewi/dacs/assignments/completed/bachelor/reports/thesis-pronk.pdf) . – Richard Chambers May 06 '17 at 20:55
-
I'm using MMLanScan for that purpose. It's very simple to get working to find IP/MAC addresses of devices on your LAN.
I use it some time ago but I think it's works with IPv6 also.

- 104
- 1
- 5
-
I took a look at the MMLanScan github repository and did not see anything specifically about IPv6 support as the phrase "Shows IP & MAC Address of available hosts" is used so not sure if that is IPv4 only or not. However it may be fairly easy to extend the source to provide an IPv6 address in addition to the IPv4 address. Have you looked at IPv6 with this package? – Richard Chambers May 03 '17 at 15:07
-
I make some test with this library in only IPv6 network and when it checks for current device ip address and subnet always get IPv4 data. I have fully disabled IPv4 on this network but the device get both address when connects to this wifi network. I make another test with Fing application to check it results and it only find IPv4 devices also. I think there isn't support for discover IPv6 devices on network. – sergiog90 May 04 '17 at 08:36
-
Thank you for taking the time to look into this. Please update your answer with your test results for IPv6. One remaining question is whether the package can be modified and extended to include IPv6. Are you able to look into that and make a determination? The author of the github repository would probably appreciate help in this area if you are able to provide it. – Richard Chambers May 04 '17 at 11:59
-
I have been in touch with Michael Mavris, developer for MMLanScan. He wrote that it is IPv4 only. However he is willing to take a github pull request if someone can provide the changes for IPv6. I can't help with this as I am not set up with an iOS development environment. – Richard Chambers May 04 '17 at 12:32
-
If I have some time I will try to add support to library for IPv6. I have one app using the library and would be interesting to discover IPv6 also. – sergiog90 May 04 '17 at 13:04
-
Wonderful! Let me know how it goes. If nothing else I can give moral support! – Richard Chambers May 04 '17 at 14:47