Main Menu

Search

Showing posts with label Linker Article Linux ping. Show all posts
Showing posts with label Linker Article Linux ping. Show all posts

LINUX: Ping Command To Ping Range of Sequential IP Addresses or Hostnames at the Same Time Simultaneously (How To Doc)

Below Ping command can be used to ping range of Sequential IP addresses at the same time simultaneously. In below ping command the sequential IP addresses we are pinging are 10.10.10.1 till 10.10.10.10. i variable defined in below command is the last octet of the IP addresses in sequence.
# for i in {1..10}; do ping -c 1 -t 1 10.10.10.$i > /dev/null 2>&1 && echo "Ping Status of  10.10.10.$i : Success" || echo "Ping Status of  10.10.10.$i : Failed" ; done

Below is example snippet of above command.

# for i in {1..10}; do ping -c 1 -t 1 10.10.10.$i > /dev/null 2>&1 && echo "Ping Status of  10.10.10.$i : Success" || echo "Ping Status of  10.10.10.$i : Failed" ; done
        Ping Status of  10.10.10.1 : Success
        Ping Status of  10.10.10.2 : Success
        Ping Status of  10.10.10.3 : Success
        Ping Status of  10.10.10.4 : Success
        Ping Status of  10.10.10.5 : Success
        Ping Status of  10.10.10.6 : Success
        Ping Status of  10.10.10.7 : Failed
        Ping Status of  10.10.10.8 : Success
        Ping Status of  10.10.10.9 : Success
        Ping Status of  10.10.10.10 : Failed

In case you want to test the ping to the hostnames you can use the same command as follows:

# for i in {1..5}; do ping -c 1 -t 1 testhost$i > /dev/null 2>&1 && echo "Ping Status of  testhost$i : Success" || echo "Ping Status of  testhost$i : Failed" ; done

In above command we assume the hostname starts with testhost1 and goes till testhost5. Below is sample output of above command.

        Ping Status of  testhost1 : Success
        Ping Status of  testhost2 : Success
        Ping Status of  testhost3 : Success
        Ping Status of  testhost4 : Success
        Ping Status of  testhost5 : Failed

Products to which Article Applies



All Linux Operating Systems.


Additional References


https://smallbusiness.chron.com/ping-ip-addresses-lan-68381.html
https://etherealmind.com/tech-notes-ping-sweep-ip-subnet/


 

LINUX: Ping Command To Get Average Response Time for Total Number of Pings? (How To Doc)

Below Ping Command can be used to get average response time for total number of pings.
ping -c <total number of pings> -q <hostname>

For e.g. if you need average response time for 5 pings to testhost, your command looks as follows:

ping -c 5 -q testhost

Below is example snippet for above command.

PING 10.10.10.10 (10.10.10.30) 56(84) bytes of data.

--- 10.10.10.10 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.087/0.095/0.112/0.012 ms

Products to which Article Applies

All Linux Operating Systems.


Additional References


https://linux.die.net/man/8/ping


LINUX: Ping Command To Print Date TimeStamps (How To Doc)

Below ping command can be used to print the date timestamps during the ping test.

ping <IP> | while read pong; do echo "$(date): $pong"; done

Below is example snippet of above command.

# ping 10.10.10.17 | while read pong; do echo "$(date): $pong"; done
Thu Oct  6 16:11:40 EDT 2016: 64 bytes from 10.10.10.10: icmp_seq=1 ttl=64 time=64.2 ms
Thu Oct  6 16:11:41 EDT 2016: 64 bytes from 10.10.10.10: icmp_seq=2 ttl=64 time=0.094 ms
Thu Oct  6 16:11:42 EDT 2016: 64 bytes from 10.10.10.10: icmp_seq=3 ttl=64 time=0.067 ms
Thu Oct  6 16:11:43 EDT 2016: 64 bytes from 10.10.10.10: icmp_seq=4 ttl=64 time=0.100 ms
Thu Oct  6 16:11:44 EDT 2016: 64 bytes from 10.10.10.10: icmp_seq=5 ttl=64 time=0.155 ms


Products to which Article Applies


All Linux Operating Systems

Additional References

https://gist.github.com/olimortimer/9c6c3cf8d1364f4fe9d2


LINUX: How To Do ARP Ping Test To Ping IP Address Over Specific Interface?

Below is command to run on source VM to do arp ping on destination VM on specific interface.


arping -c 3 -I <Source VM Interface> <Destination VM IP>

Below is snippet of above command.


[root@testVM ~]# arping -c 3 -I <eth0> 192.168.0.1
ARPING 192.168.0.1 from 192.168.20.6 bond1
Unicast reply from 192.168.0.1 [80:00:ZZ:ZZ:ZZ:YY:YY:YY:ZZ:ZZ:ZZ:YY:YY:YY:97:C3:52]  0.694ms
Unicast reply from 192.168.0.1 [80:00:ZZ:ZZ:ZZ:YY:YY:YY:ZZ:ZZ:ZZ:YY:YY:YY:97:C3:52]  1.688ms
Unicast reply from 192.168.0.1 [80:00:ZZ:ZZ:ZZ:YY:YY:YY:ZZ:ZZ:ZZ:YY:YY:YY:97:C3:52]  0.713ms
Sent 3 probes (1 broadcast(s))
Received 3 response(s)
[root@testVM ~]#

Products to which Article Applies


All Linux Operating Systems

Additional Reference

https://www.poftut.com/arping-command-tutorial-examples-linux/