Ping and Arp script

There should be better ways, but this will do for the moment.

#!/bin/bash
for ipadr in 192.168.0.{1..254}
do
 ping -c 1 -w 1 $ipadr
done
arp -n | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | grep ether
% ./ping.sh
192.168.0.1    ether   00:0d:02:xx:xx:xx   C  eth0
192.168.0.193  ether   50:7e:5d:xx:xx:xx   C  eth0
192.168.0.196  ether   c0:ff:d4:xx:xx:xx   C  eth0

pingsh

Leave a Reply

Your email address will not be published. Required fields are marked *