ip command nuggets
View IP address related information (all interfaces):
ip address
or
ip a
View the ARP table
ip neighbors
Cross-reference the IP addresses in the ARP cache with their local hostnames (if known). Replace “@localhost” with the hostname/IP address of the DNS server you want to query, or remove it altogether to use the system’s default DNS server:
for ip in $(ip nei | awk '{print $1}'); do dig -x $ip @localhost | grep "in-addr.arpa"; done
Or, wrapped in a shell function:
arp () { for ip in $(ip nei | cut -d' ' -f1); do dig -x $ip @localhost | grep "in-addr.arpa"; done }