Skip to content

Instantly share code, notes, and snippets.

@Scarysize
Last active January 18, 2018 09:36
Show Gist options
  • Save Scarysize/9302990ffe1a5b95ad7d401ce6204979 to your computer and use it in GitHub Desktop.
Save Scarysize/9302990ffe1a5b95ad7d401ce6204979 to your computer and use it in GitHub Desktop.
Retrieve MAC addresses via SNMAP or ping sweep.

Using snmpwalk, this pulls the ARP table from the agent (e.g. router, switch):

snmpwalk -v 2c -c <community> <agent-ip> 1.3.6.1.2.1.4.22.1.2

OID: http://www.alvestrand.no/objectid/1.3.6.1.2.1.4.22.1.2.html

The ARP information might be stale though.

Using nmap ping-sweep:

sudo nmap -sP -n <ip>/24

Must be run as root, otherwise it won't return MAC addresses, just IPs.

See details: https://networkengineering.stackexchange.com/questions/6625/what-is-the-difference-between-ipnettomediaphysaddress-and-dot1qtpfdbport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment