Wednesday, March 6, 2019

Determine IP address from MAC address, in Linux

Found a switch in a closet.. not documented and I'm too lazy to haul a laptop over and try to hit the console so I took a picture of the MAC label and stumbled across this literal GEM of a one-liner:

nmap -sP <subnet>/24 >/dev/null && arp -an | grep xx:xx:xx:xx:xx:xx | awk '{print $2}' | sed 's/[()]//g'

 It literally just works.

No comments:

Post a Comment