Q:

C Program to find UP and DOWN machines.?

Suppose I have a scenario like below : 
There are about 225 Computers having the following range of IP addresses and hostnames:-
PC-LAB         IP ADDRESS RANGE       HOSTNAME RANGE
PC-LAB1  10.11.2.01 -   10.11.2.30  ccl1pc01 - ccl1pc30
PC-LAB2  10.11.3.01 -   10.11.3.30  ccl2pc01 - ccl2pc30
PC-LAB3  10.11.4.01 -   10.11.4.45  ccl3pc01 - ccl3pc45
PC-LAB4  10.11.5.01 -   10.11.5.50  ccl4pc01 - ccl4pc50
PC-LAB5  10.13.6.01 -   10.13.6.65  ccl5pc01 – ccl5pc65

I want to write a program (in C / C++) that will take the above IP address and hostname ranges as input and create two separate files, one with 225 entries of IP 
addresses and another with 225 entries of hostnames.. 
Then the program will figure out which of these machines are up and which are down and then create two files one containing 
hostname  and IP addresses of the systems which are UP and another which are DOWN.
E.g. 
FILE1.down
Hostname   IP address
ccl1pc10   10.8.2.10
ccl5pc25   10.11.5.25

Note : If any ubuntu command simplifies this work..we can use that in the program for sure..!!

A:

Look at fping
Run this command, sit back and relax:
fping ccl{1..6}pc{01..60} 

this will print a list of 

All hosts that have a DNS name/IP record and are up
All hosts that have a DNS name/IP record but are down
All hosts that are not in the DNS (I guess you can ignore these)

Regards

