Ping is a universal command that is available on every operating system to test the reachability of a network. When you shoot your terminal with the ping command and an IF address as its argument, the machine will try to send some bits of raw data towards the machine owning that IF address. If some machine exists with that IF address, it will send back certain bits. Thus the machine receives the bits and it confirms that a path is available from the current machine to the other through a network. We can check the existence of certain machines on the network by just pinging.
To see which machines are up in the current network, let's write a bit of shell script. Open vim as the root:
#/bin/bash
for I in 192.168.L{1..255};f1 checks 192.168.1.x class ofIPs. do
ping -c2 $i > Idev Inull;
[ $? -eq a 1 && echo $1 is up .
trap "exit" SIGlNT II To force exit when Ctrl+C keystroke is applied.
done
Save the file, and make it executable by running the following command:
[slynux@gnuxbox-]$netup.sh 192.168.1.1 is up.
192.168.1.3 is up.
192.168.1.4 is up.



Reply With Quote
Copyright Techfuels
Bookmarks