Ping

Vicente González Ruiz

January 31, 2024

Contents

 1 Time measurement
 2 Bit-rate measurement
 References

1 Time measurement

Ping can provide statistics about latencies.

Figure 1: Timeline of a ping interaction between two hosts A and B, interconnected by simple communication link.

To measure latencies, we will use ping [21], a tool that sends (one or more) ICMP Echo Request messages to an IP address and waits for receiving (one or more) ICMP Echo Reply messages generated by the (OS of that) host, measuring the so called RTT (Round-Trip Time). For example, in the Figure 1 are described the different time components in which a RTT can be decomposed. In this figure, \(t_t\) stands for transmission time, and \(t_p\) (again) for propagation time. A simple link (two wires, for example) using TDM (Time-Domain Multiplexing) has been supposed. For this reason, the propagation and transmission times are identical in both directions. Notice that if the payload of the ping message has only 64 bytes (the default value in most ping implementations) and the bit rate of the link is high, then \(t_p\gg t_t.\) In a LAN, for example, it also holds that \begin {equation} \text {RTT} = 2t_p + 2t_t. \label {eq:RTT} \end {equation}

2 Bit-rate measurement

Usually, to determine the throughput, we need to use a tool such as iPerf to measure the link capacity between two end-points (of different hosts) in the Internet. Unfortunately, this procedure implies that we must have access to both hosts to install and run this program, privileges that are not always available.

Alternatively, we can estimate the link throughput using ping. However, it is important to realize that ping has been designed to measure latencies, not bit-rates, and that, for this reason, we will only be able to estimate throughputs, rougtly.

Said that, the transmission bitrate available between two directly reachable IP devices can be found with \begin {equation} b=\frac {B}{t_t}, \label {eq:b} \end {equation} where \(B\) is the number of bits sent in a ping payload, and \begin {equation} t_t = \frac {\text {RTT}_{\text {max}}-2t_p}{2}, \label {eq:tt} \end {equation} an equation that can be determined by revisiting the ping timeline shown in the Figure 1 and the Eq. 1. In this expression, \(\text {RTT}_{\text {max}}\) represents the average1 RTT measured when we send the maximum2 number of bytes in the payload of the ping, and \begin {equation} t_p \approx \frac {\text {RTT}_{\text {min}}}{2}, \label {eq:tp} \end {equation} where \(\text {RTT}_{\text {min}}\) presents the minimum3 RTT measurement when we send the minimum4 payload.

Therefore, to estimate \(b\) for the near future, we must perform the following steps:

  1. Run ping using the smallest possible payload that provides RTTs values.5 Use it to calculate \(t_p\).
  2. Run ping using the largest possible payload to achieve that the most part of the average RTT provided by ping corresponds to \(t_t\). It is necessary to use the highest payload-size because the accuracy of the cronometer used by ping, in general, is not high enough.
  3. Use Eq. \eqref{eq:tt} to find \(t_t\) as a function of the average RTT and the minimal \(t_p\).
  4. Finally, use Eq. \eqref{eq:b} to determine \(b\).

If the devices cannot be ping-ed, and supposing that there is only one point in the communication link that is filtering the ICMP Echo Request traffic in each direction, then we can compute the total RTT as the sum of the RTTs from the devices that we want to connect (where the InterCom is it supposed to be run) to the filter (possiblely, one of your home routers).

You can use www.meter.net to test your pings.

[1]   Behrouz Forouzan. Introduction to Data Communications and Networking. McGraw-Hill, 2007.

[2]   James F. Kurose and Keith W. Ross. Computer Networking: A Top-Down Approach Featuring the Internet. Pearson, 2013.

1Remember that ping can generate a number of time measurements.

2We should use a payload as large as possible (ideally, an infinite number of bytes), in order to make \(t_t\) a significant amount of time, which is easy to measure

3Again, remember that ping returns a collection of RTTs, a we should use the minimun beause the latency of the link should be a constant and the congestion always increases this value.

4If the payload of the ping is small enough (\(0\) bytes ideally), it would happen that \(t_t=0\).

5The minimal payload for a ping message can be 0, but depending on the implementation of ping you might have to use a larger value.