How to Write a Continuous Ping Command to a Text File

The ping is one of the most popular commands for users, system administrators, and network administrators. Even it is generally used simply to check remote system network connectivity it provides different features for testing. One of the useful features of the ping is the continuous ping which will continuously ping to the specified target.

How Does Continuous Ping Work?

The continuous ping is sending ping packets forever without interrupting. So in a continuous ping, multiple ping packets will be sent on a regular basis. A ping packet is an ICMP packet that is routed from the source to the destination as long as the TTL is not 0.

Continuous Ping For Windows (Windows 7, 8, 10 and Server)

The ping is a command-line tool and command which is executed via the MS-DOS, Command-Line, or PowerShell. So first we will open the command line from the start menu by typing msdos or cmd or powershell etc.

Open MS-DOS or Command Prompt

We will type the following ping command. The -t option is used for the continuous ping. By default, the ping command will send 4 packets to the target and then stop pinging.

          > ping -t wisetut.com        
Continuous Ping In Windows

During the continuous ping information about every ping, the packet will be printed on the screen. The target IP address, ping packet size, ping time, and TTL information are provided. The continuous ping output will continue as long as it is not stopped and all-new output will be scrolled down on the screen automatically.

As its nature, continuous ping will continue forever but in most cases, you will need to stop it. A continuous ping can be stopped in Windows by using the CTRL+c key shortcut which is used to kill a process.

          CTRL+c        

When the continuous ping is stopped with the CTRL+C keyboard shortcut some statistics about the continuous ping are displayed like below. Ping statistics like packet sent, packet received, packet lost, approximate round trip times (minimum, maximum, average).

Continuous Ping Statistics

Continuous Ping For Linux (Ubuntu, Debian, Mint, CentOS)

The Linux provides the ping command too. But the biggest difference from Windows is that the continuous ping features are provided by default. So there is no need to provide extra parameters to make ping continuous. We will just provide the ping target like below and the ping operation continues forever even the network is disconnected. But first, a Linux terminal should be opened from the menu.

          $ ping wisetut.com        
Continuous Ping In Linux (Ubuntu, CentOS, Debian, Mint…)

The output of the continuous ping can be stored inside a file easily by using the output redirection features of the bash. Just use the > redirect sign and provide the file name you want to store the output.

          $ ping wisetut.com > wisetut_ping.txt        

The target host can be also provided as an IP address.

          $ ping 192.168.122.1 > wisetut_ping.txt        

As the ping command works continuously by default you may want to restrict to ping count to a specific number. The first way is using the CTR+C which will stop the continuous ping process and exit.

          CTRL+C        

The more reliable way is using the -c parameter which will specify the count of the ping packets. So we will provide the count as 5 for the following example.

          $ ping -c 5 wisetut.com                  

Continuous Ping For MacOS

The MacOS is an operating system that is derived from the Unix roots which are the same as the Linux operating systems and distributions. So the ping command of the MacOS provides the same behavior as the Linux distributions. First, open the Terminal from the Applications -> Utilities.

          $ ping wisetut.com        

Like Linux distributions, the ping will run forever unless it is aborted. Alternatively, we can also specify the ping count with the -c option.

          $ ping -c 5 wisetut.com                  

Continuous Ping For Cisco, Router, Firewall, Switch, and IOS

As a popular network brand with a lot of different products like Router, Firewall, Switch, and IOS platform. Cisco's command-line interface also provides continuous ping with the repeat option. You should also provide the repeat count where in order to make it continuous.

          $ ping 192.168.1.1 repeat 9999999        

We can also make continuous ping for a domain or hostname like below.

          $ ping wisetut.com repeat 9999999        

Continuous Ping For Juniper and JunOS

Juniper is a BSD-based platform that provides the same behavior as Linux. So there is no need for the extra parameters in order to continuous ping.

          $ ping 192.168.1.1        

We can also make continuous ping for a domain or hostname like below.

          $ ping wisetut.com        

Alternatively, you can use GUI in order to ping the remote system. As ping and continuous ping is a diagnostic operation you should use the Diagnostics Tool. Then follow Tools>Diagnostics>Continuous Ping or Ping>Continuous Ping .

Continuous Ping For Huawei

Another popular network brand is Huawei where you make create a continuous ping. Huawei provides similar behavior to Windows where the -c option is provided for the continuous ping.

          $ ping -c 99999 192.168.1.1        

We can also make continuous ping for a domain or hostname like below.

          $ ping -c 99999 wisetut.com        

taylorcoled1958.blogspot.com

Source: https://wisetut.com/how-to-continuous-ping-in-windows-linux-and-macos/

0 Response to "How to Write a Continuous Ping Command to a Text File"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel