shell script
Hi,
i want to see which ip addresses are live and which ip addresses are dead so that i write a shell script as shown in below #/bin/bash ping=1 echo -e "\nenter ip range exampie is 10.10.3.:\c " read number while [ $ping -le 10 ] do ping -c 2 $number$ping (( ping++ )) done but now i want save the file separately live and dead ip address |
sagar666,
You can check the manual page for ping on your distro, or just manually check the return code from the ping command. But on the distro I'm using, ping returns zero if successful, non-zero otherwise. So I would tend to do something like the following. Code:
#!/bin/bash I also might add something to check the format of the input value before using it. |
Job of nmap?
Code:
nmap -sP 10.10.3.0/25 > alive |
Thanks rigor and hyperdaz
one more thing if host machine is in off it wont ping and it ip address goes to dead file. i want know only unassigned ip addresses even machines is in off ??? |
Hi Sagar666,
I take it you have a full list of all hosts on the network, as any tool would not know if its "OFF" or "not assigned", ping or pretty much any networking tool is looking at what is turned ON. As you are only scanning 10 IPs from your original script Quote:
Quote:
You can probably find most serial numbers of machines that are on with "dmesg" If you are going to test the whole network something like 128 or 256 range then ping is going to take quite a long time not sure if that's an issue, nmap will take a much shorter time. If you do have a work network or a large network then you might want to set up a monitoring tool this will check many different things for you non-stop i.e. something like Nagios Core http://www.nagios.org or (M)/Monit http://mmonit.com. hdaz |
Hi hdaz,
if i try to nmap -sP 10.10.3.0/25 > alive getting error nmap command not found in redhat 6.1 sagar |
Just to confirm that is RHEL 6.1? or redhat 6.1 the latter was dated about 1996 and RHEL was a couple of years ago
to be sure run: Code:
cat /etc/redhat-release to install nmap on RHEL Code:
up2date install nmap Code:
yum install nmap Nmap is a very powerful tool that can gather a lot of information with different optoins etc, then if you are not the Admin of the network/servers/VMs/desktops then you might want to ask for permission first. Hdaz |
Quote:
Later versions of v4 (4.8, 4.9 ??) also had the option to install and use yum instead of up2date. |
I installed nmap .Now it is working fine and also very powerful tool.we can verify all up ips with a seconds
Thank u very much |
All times are GMT -5. The time now is 03:37 AM. |