I have a question is there any possibility for maken a script that you can see if computers are on in your network
when you run the script for ex. ./ping.sh 54 62 62 , a script when you give as argument the last digit of the ip adres of the computers

my network is 192.168.129.0

This is what i already have but i want to give extra parameters to the script
for example
parameter 1: xx-yy: this parameter ensures that all computers be test in the range of xx-yy eg. 61-67, test all the 7 computers with the last digit

parameter 2: -t , ensures that each number count with 200 eg. -t 17 test the ip adress 217 , -t 17-19 test all the adresses 217 to 219

for ip in 192.168.1.{1..10}; do  # for loop and the {} operator
    ping -c 1 -t 1 192.168.1.1 > /dev/null 2> /dev/null  # ping and discard output
    if [ $? -eq 0 ]; then  # check the exit code
        echo "${ip} is up" # display the output
    else
        echo "${ip} is down"
    fi
done

Hi,

did you considered the fping command? With the -g option you can define a range:

fping -c 1 -g 192.168.129.1 192.168.129.20
fping -c 1 -g 192.168.129.0/24

And to get just the active IPs do:

fping -c 1 -g 192.168.129.1 192.168.129.20 2> /dev/null
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.