How To Get Mac Addresses Of Hosts With Nmap?
Nmap is very useful tool. I is used by penetration testers mainly but from operation perspective it is used by system administrators too. Nmap have a lot of different features. Mac related feature can be used to get mac addressees of the hosts in the same network segment. I can be used to get remote systems mac addresses but snmp should be enabled in remote systems.
Get Mac Address Of Local System
Getting local systems mac address is easy and have a lot of different ways. Here we simply use ip tools.
$ ip link
Get Mac Address Of Remote But Same Network System
We can use nmap to get mac address og a host if we are in the same network segment.
$ sudo nmap -sP -n 192.168.122.0/24
Get Mac Address Of Remote System With Snmp
The more complicated way is using snmp service. Snmp tools can be used to get mac address of the hosts. Here we use nmap snmp script toquery snmp service simply.
$ sudo nmap -sU -p 161 -T4 -d -v -n -Pn --script snmp-interfaces ubu1