#!/bin/bash
############################################################
#                                                          #
#  Get all MAC adresses from all IP addresses know in LAN  #
#                                                          #
#  Koentje  (remon@cobrasoft.nl)                           #
#                                                          #
############################################################

IP=$(ifconfig eno2 | grep -w inet | awk '{print $2}')
MAC=$(ip a show eno2 | grep link/ether | awk '{print $2}')

tail -n+2 /proc/net/arp | awk '{printf " "$1"\t\t"$4"\n"}' > /tmp/ipmacs.tmp
printf " $IP\t*\t$MAC\n" >> /tmp/ipmacs.tmp

echo -e "\n IP Adress\t\tMAC Adress"
echo -e "------------------------------------------"
cat /tmp/ipmacs.tmp | sort -n
echo -e "------------------------------------------\n"
