Press Ctrl/Cmd + P to print
or save as PDF

Using Ping Command in Linux Based VPS

The Linux ping command major function is to use an IP network to control the network connectivity status between a source and a device. It accesses the time duration for sending and receiving responses from a network to inform us regarding the execution of the network. A ping test allows you to determine the following aspects between your device and the host.

  • Status regarding if the targeted host is reachable or not.
  • Measurement of time between the round trip, from a host to a device, and back to the host.
  • Percentage of lost packets in the network.

In this article, we will be guiding you on how to use the ping command in Linux based VPS and how it is able to help you.

Ping Installation

The ping command should be installed in most Linux systems by default. However, in the case it isn’t in the system, first, access your VPS using SSH. Then, run the following command to verify if the ping command is installed or not.

ping -V

If the ping isn’t installed, run the command below to install it.

apt-get update && apt-get install -y iputils-ping

Usages of Ping Command

Connectivity Check

To check the status of the target host and server, you may run the following command.

ping google.com

In the example above, we were checking the network connectivity with the Google domain. You can also use the IP address if do not know the domain. You will be able to see a statistical summary with three aspects, which are min, avg, and max.

  • min – The lowest time taken to receive a response.
  • avg – The average time needed to receive a response.
  • max – The highest time taken to receive a response.

Press Ctrl+C to stop the ping command and stop sending packets to the targeted host.

Specify ECHO_REQUEST Number

Use the -c command option to specify the number of packets or requests done by the user.

ping -c <number_of_pings> <domain_name>

Replace the “<number_of_pings>” with the number of pings that are needed to be performed and “<domain_name>” with a domain.

Audible Ping

To allow the command to make a beeping noise when checking if the host is active or not, use the “-a” option.

ping -a <domain_name>

Intervals Between Packets

By using the “-i” option, you can also set time intervals between packets in seconds. The following command is an example of setting intervals between packets.

ping -i 2 -c 7 <domain_name>

Receive Summarized Report

Use the “-q” option if you only need the summary of the network such as the following command.

ping -c 6 -q <domain_name>

Stress Test

To test how well your website or server is able to handle the network stress, you may use the “-f” option to send 100 or more packets per second.

ping -f <domain_name>

This is all for the ping command. Hope it could be useful for troubleshooting your server with the options above.