ping's Examples

Open the Terminal application and type the following command to test the connection to server yahoo.com server

ping yahoo.com

 stop after sending 4 ECHO_REQUEST packets with the -c option

## Controlling the number of pings i.e. only send 4 ping requests to cyberciti.biz server ##
ping -c 4 cyberciti.biz

Pass the -n option to avoid to lookup symbolic names for host addresses i.e. numeric output

ping -n -c 4 cyberciti.biz

you rebooted the remote server or connectivity is down between your home and ISP network. You can get notified with the small -a option. The following will output a bell (ASCII 0x07) character in the output when any packet is received

ping -a host-name-here
ping -a 192.168.1.254

 (capital -A) will output a bell character when no packet is received before the next packet is transmitted

ping -A www.cyberciti.biz
ping -A 192.168.1.254

the route for given address/dns name by passing the -R option

ping -R www.cyberciti.biz

Pass the -f option and must be run as the root user

sudo ping -f cyberciti.biz

How to use ping preload mode

ping -l 10 www.cyberciti.biz

Setting timeout for the ping

ping -t

IPv4 vs IPv6 ping

ping -4 www.cyberciti.biz # IPv4 ping
ping -6 www.cyberciti.biz # IPv6 ping
ping6 www.cyberciti.biz # Always use the IPv6

Summing up

man ping

To check the network connection to host canopus and specify the number of echo requests to send

ping canopus 5

To obtain information about host opus and specify the number of data bytes to be sen

ping -s 2000 opus

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us