How can I find all MAC addresses connected to a LAN network? Is there a way or protocol to do this?

  • Network protocols really are not designed for that, and whatever method you use can miss some. In fact, if the the ethernet network is switched and uses a Private VLAN, then it can be impossible to even see the broadcast traffic of neighboring hosts on the same ethernet broadcast domain. In the old days with ethernet on a bus, every host saw every frame but simply is not the case with modern switched ethernet.
    – Ron Maupin
    May 29 at 16:47

2 Answers 2


Just take a look at the MAC table (also source address table) in your managed switch - each device having transmitted a frame within the mac aging period shows up in there.

Other than that there's no way to see each and every address. There are several ways to get most addresses though, including the most trivial methods, just listening to broadcasts for a while or running an ARP sweep. If your devices use DHCP then you see the leases on your DHCP server.

  • And if you can't do that then yeah, do a packet capture on the network for a few hours/days and filter for broadcasts. You'll likely get a significant number of all working MAC addresses connected to the network during that time. May 26 at 22:25
  • This is supposed to be an automated task, Something that can be done with a python code or bash commands.
    – BHP
    May 27 at 14:17
  • @Behzad Sure, where's the problem? We cannot write your code nor recommend any products here though.
    – Zac67
    May 27 at 14:20
  • 1
    Packet capture is easily done on the command line or in code as long as the computer has the right software installed. Tshark, TCPDump etc can do it and can be called from external code. May 27 at 16:58
  • 1
    "looking inside a OS table" . This is exactly it, with the OS of the switch. You can't have more straightforward than this. You can perform a quick network scan (with nmap) prior to querying the table to ensure all hosts are listed.
    – JFL
    May 31 at 12:49

Are you averse to doing a ping scan? If you're not against it, make a script to ping all hosts in the local network. Check your hosts arp table for IP to MAC address mapping.

  • Not everything that uses a MAC address has to use IP as well.
    – Teun Vink
    Jun 1 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.