Almost every device that connects to the internet, including Windows and Linux computers, offers the Ping command. Ping command is a diagnostic tool for assessing network connections. This article will look at how to use continuous ping for Windows and Linux to get a better understanding of your network performance.
How Does Network Ping Work?
The term “ping” comes from sonar technology, which sends out a pulse of sound and listens for an echo caused by the sound hi[tting something. Ping tools are built into most operating systems on computers, and they work in a similar fashion. The computer sends packets of information out to a device and waits to hear a response from the other device. The ping tool tells you how long it took for the data packet to make the round trip, or that the transfer was unsuccessful with a closed network.
The idea sounds simple enough, and it is, but there are plenty of benefits of using a continuous ping. Pinging lets you test if your computer can connect to other devices, such as a router, on the local network. Ping also tells you if your device can connect to the internet and other devices. Knowing how long it takes your computer to connect, assuming it can connect, helps you understand if there is a network problem on the local network or if the issue comes from elsewhere. If it takes a long time for the packet to go back to your computer, this is a sign of a slow connection. It also alerts you to lost data packets.
One of the best things about ping is that the process is relatively the same no matter which operating system you use. The only difference is the command terminal you use, and the command itself.
Continuous Ping in Windows
The ping command for Windows sends out four data packets when set to default. The packets are sent to a specific IP address/hostname set by you. The continuous ping command lets you continue to send more packets over time to assess the network connection continually. Here’s how to set up a continuous ping in Windows.
Start by opening a Windows command prompt by holding the Windows and R key and entering CMD into the run box.
Enter the ping command as well as the -t option along with the IP address. Press enter to start the command. Use ping -t 220.127.116.11, for example.
Windows responds to the command by running an endless ping on the chosen IP address.
Ping will add an entry to the standard output each time that a packet returns home to the host computer. The information is recorded into the terminal automatically unless you change other settings. The output for the command includes the IP address for the pinged computer, the size of the response packet to check for data loss, the response time, measured in milliseconds, and the Time to Live for the packet.
The command prompt sends out the ping command once a second until you end the continuous ping. You can end the command by ending the command line program, which you do by holding Control and pressing C.
The program will show a summary of ping statistics and a conclusion when you end the command and stop pinging the target computer. You will get these results as a terminal output when you use the Control + C command to end the ping.
If you want, you can use another command to transfer the standard output into a text file for you. You do this by including a greater-than symbol and a file name for the data to be sent to. For example;
ping -t 18.104.22.168 >; logfile.txt
You can use an existing file or have the computer automatically create the file for you if it doesn’t already exist. The recorded log includes information about the data packets and the ping statistics from the test.
Continuous Ping in Linux
Continuous ping is one of those rare examples where something is easier in Linux. This is because Linux automatically runs endless loops for pings by default. Here’s how you can use Linux to run a continuous ping.
Open up the terminal for the Linux distro you use. The easiest way to do this is to use a keyboard combination. Hold Control + Alt and press T to load up the terminal.
Enter a ping command into the terminal and include the IP address of the target computer. Run the command by pressing enter.
Linux also allows you to create a log file of the information from the ping test. The command used to do this follows the same syntax as the Windows command. For example;
Ping 93.271.294.43 >; logfile.txt.
One interesting thing about Linux is that it lets you include a timestamp to the results in the logfile. Adding the command -D tells Linux to include a UNIX timestamp in the ping results.
Ping -D 93.271.294.43 >; logfile.txt.
Given that Linux pings on a loop by default, you’ll have to define how often you want it to ping if you don’t want to use an endless loop. You can do this with the -c command. For example;
Ping -c 4 93.271.294.43 >; logfile.txt.
This command would tell Linux to ping the address four times before creating the logfile and terminating itself.
Knowing how long it takes your computer to connect to servers and computers is a handy piece of information to have in diagnostics. The ping command runs four times by default on Windows, so you’ll need to include a little bit of extra code to make it run a continuous ping. Linux runs an endless loop of ping by default. For Linux, you need to define a set number of pings rather than having to set it to run continuously.